nuxt
nuxt copied to clipboard
call watchClient() without using a hook
What problem does this feature solve?
i am changing the options.srcDir on build time, to include several files from other locations. in the builder.js watchClient() is being called on the build:done hook. i want this call to be without hooks and before build:done so i can change the srcDir to the appropriate folder.
What does the proposed changes look like?
if (this.options.dev) {
// Start watching after initial render
this.nuxt.hook('build:done', () => {
consola.info('Waiting for file changes');
this.watchClient();
});
// Stop watching on nuxt.close()
this.nuxt.hook('close', () => this.unwatch());
}
to
if (this.options.dev) {
// Start watching after initial render
consola.info('Waiting for file changes');
this.watchClient();
// Stop watching on nuxt.close()
this.nuxt.hook('close', () => this.unwatch());
}
// Call done hook
await this.nuxt.callHook('build:done', this);