Nuxt/4/Absolute Watch Path
Last update
Jul 25, 2024
This codemod converts paths emitted by Nuxt's builder:watch hook from relative to absolute, enhancing support for external directories and complex patterns.
🚦 Impact Level: Minimal
What Changed
The Nuxt builder:watch
hook now emits a path that is absolute rather than relative to your project srcDir
.
Reasons for Change
This change allows support for watching paths that are outside your srcDir
, and offers better support for layers and other more complex patterns.
Before
nuxt.hook('builder:watch', (event, path) => {someFunction();});
After
nuxt.hook('builder:watch', (event, path) => {path = relative(nuxt.options.srcDir, resolve(nuxt.options.srcDir, path));refreshFunction();});
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community