fix(builder): resolve aliases in build.watch paths (#9153)

This commit is contained in:
Daniel Roe 2021-04-15 20:17:15 +01:00 committed by GitHub
parent 8ebb92a9f6
commit 9f6131edd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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)