mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +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))
|
||||
},
|
||||
use: perfLoader.pool('js', {
|
||||
loader: 'babel-loader',
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: this.getBabelOptions()
|
||||
})
|
||||
},
|
||||
|
@ -22,7 +22,10 @@ export default class PerfLoader {
|
||||
}
|
||||
|
||||
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'])
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,10 @@ describe('webpack configuration', () => {
|
||||
perfLoader.warmup = jest.fn()
|
||||
perfLoader.warmupAll()
|
||||
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'])
|
||||
|
||||
const loaders = perfLoader.pool('js', { loader: 'test-perf-loader' })
|
||||
|
Loading…
Reference in New Issue
Block a user