From 9f6131edd386fd1f6c3624dfd956b3e65e88b5d6 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 15 Apr 2021 20:17:15 +0100 Subject: [PATCH] fix(builder): resolve aliases in `build.watch` paths (#9153) --- packages/builder/src/builder.js | 2 +- packages/builder/test/builder.watch.test.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/builder.js b/packages/builder/src/builder.js index 5ebf39581b..a59764bd18 100644 --- a/packages/builder/src/builder.js +++ b/packages/builder/src/builder.js @@ -661,7 +661,7 @@ export default class Builder { const customPatterns = uniq([ ...this.options.build.watch, ...Object.values(omit(this.options.build.styleResources, ['options'])) - ]).map(upath.normalizeSafe) + ]).map(this.nuxt.resolver.resolveAlias).map(upath.normalizeSafe) if (customPatterns.length === 0) { return diff --git a/packages/builder/test/builder.watch.test.js b/packages/builder/test/builder.watch.test.js index 255d30be8b..03bb607821 100644 --- a/packages/builder/test/builder.watch.test.js +++ b/packages/builder/test/builder.watch.test.js @@ -178,10 +178,10 @@ describe('builder: builder watch', () => { middleware: '/var/nuxt/src/middleware' } nuxt.options.build.watch = [ - '/var/nuxt/src/custom' + '~/custom' ] nuxt.options.build.styleResources = [ - '/var/nuxt/src/style' + '~/style' ] const builder = new Builder(nuxt, BundleBuilder) builder.createFileWatcher = jest.fn() @@ -189,8 +189,8 @@ describe('builder: builder watch', () => { builder.watchClient() const patterns = [ - '/var/nuxt/src/custom', - '/var/nuxt/src/style' + 'resolveAlias(~/custom)', + 'resolveAlias(~/style)' ] expect(builder.createFileWatcher).toBeCalledTimes(3)