mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix(builder): use require.resolve to get the path of babel-loader (#4150)
This commit is contained in:
parent
ff6385f5a0
commit
60dbc6ddc5
@ -164,7 +164,7 @@ export default class WebpackBaseConfig {
|
|||||||
return !modulesToTranspile.some(module => module.test(file))
|
return !modulesToTranspile.some(module => module.test(file))
|
||||||
},
|
},
|
||||||
use: perfLoader.pool('js', {
|
use: perfLoader.pool('js', {
|
||||||
loader: 'babel-loader',
|
loader: require.resolve('babel-loader'),
|
||||||
options: this.getBabelOptions()
|
options: this.getBabelOptions()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -22,7 +22,10 @@ export default class PerfLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
warmupAll() {
|
warmupAll() {
|
||||||
this.warmup(this.workerPools.js, ['babel-loader', '@babel/preset-env'])
|
this.warmup(this.workerPools.js, [
|
||||||
|
require.resolve('babel-loader'),
|
||||||
|
require.resolve('@babel/preset-env')
|
||||||
|
])
|
||||||
this.warmup(this.workerPools.css, ['css-loader'])
|
this.warmup(this.workerPools.css, ['css-loader'])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,10 @@ describe('webpack configuration', () => {
|
|||||||
perfLoader.warmup = jest.fn()
|
perfLoader.warmup = jest.fn()
|
||||||
perfLoader.warmupAll()
|
perfLoader.warmupAll()
|
||||||
expect(perfLoader.warmup).toHaveBeenCalledTimes(2)
|
expect(perfLoader.warmup).toHaveBeenCalledTimes(2)
|
||||||
expect(perfLoader.warmup).toHaveBeenCalledWith(js, ['babel-loader', '@babel/preset-env'])
|
expect(perfLoader.warmup).toHaveBeenCalledWith(js, [
|
||||||
|
require.resolve('babel-loader'),
|
||||||
|
require.resolve('@babel/preset-env')
|
||||||
|
])
|
||||||
expect(perfLoader.warmup).toHaveBeenCalledWith(css, ['css-loader'])
|
expect(perfLoader.warmup).toHaveBeenCalledWith(css, ['css-loader'])
|
||||||
|
|
||||||
const loaders = perfLoader.pool('js', { loader: 'test-perf-loader' })
|
const loaders = perfLoader.pool('js', { loader: 'test-perf-loader' })
|
||||||
|
Loading…
Reference in New Issue
Block a user