mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
0f104aa588
- Better insights and inspection for server bundle - Remove all vue related dependencies from vue-renderer package as much as possible to reduce install size of nuxt-start - Support for single file distributions (serverless) - Remove server-bundle.json and use the standard .js files for dist/server - Mitigate CALL_AND_RETRY_LAST Allocation failed errors. Most of the cases happen on JSON.parse() the part when loading bundle. (#4225, #3465, #1728, #1601, #1481) - Reduce server dist size by removing escape characters caused by JSON serialize - Faster dev reloads and production start by removing extra JSON.serialize/JSON.parse time - Less memory usage - General performance improvements and refactors
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
|
|
import path from 'path'
|
|
import PerfLoader from '../../packages/webpack/src/utils/perf-loader'
|
|
|
|
describe('webpack configuration', () => {
|
|
test('performance loader', () => {
|
|
const js = { name: 'js', poolTimeout: Infinity }
|
|
const css = { name: 'css', poolTimeout: Infinity }
|
|
PerfLoader.warmup = jest.fn()
|
|
PerfLoader.warmupAll({ dev: true })
|
|
expect(PerfLoader.warmup).toHaveBeenCalledTimes(2)
|
|
expect(PerfLoader.warmup).toHaveBeenCalledWith(js, [
|
|
require.resolve('babel-loader'),
|
|
require.resolve('@babel/preset-env')
|
|
])
|
|
expect(PerfLoader.warmup).toHaveBeenCalledWith(css, ['css-loader'])
|
|
|
|
const perfLoader = new PerfLoader({
|
|
name: 'test-perf',
|
|
options: {
|
|
dev: true,
|
|
build: {
|
|
parallel: true,
|
|
cache: true
|
|
}
|
|
}
|
|
})
|
|
expect(perfLoader.workerPools).toMatchObject({ js, css })
|
|
const loaders = perfLoader.use('js')
|
|
const cacheDirectory = path.resolve('node_modules/.cache/cache-loader/test-perf')
|
|
expect(loaders).toMatchObject([
|
|
{ loader: 'cache-loader', options: { cacheDirectory } },
|
|
{ loader: 'thread-loader', options: js }
|
|
])
|
|
})
|
|
})
|