nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

call watchClient() without using a hook

Open volkovmqx opened this issue 5 years ago • 0 comments

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);
This feature request is available on Nuxt community (#c8416)

volkovmqx avatar Jan 07 '19 10:01 volkovmqx