mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(webpack): chunk name normalization for catch-all pages and windows (#7603)
This commit is contained in:
parent
56b158e7d6
commit
d89812f241
@ -18,10 +18,9 @@ export const wp = function wp (p = '') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const wChunk = function wChunk (p = '') {
|
export const wChunk = function wChunk (p = '') {
|
||||||
if (isWindows) {
|
// workaround for SplitChunksPlugin that generate names starting from . for catchAll pages _.vue
|
||||||
return p.replace(/\//g, '_')
|
// consider using https://webpack.js.org/configuration/output/#outputfilename for more robust control over filename generation
|
||||||
}
|
return p.replace('_', '[_]')
|
||||||
return p
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const reqSep = /\//g
|
const reqSep = /\//g
|
||||||
|
@ -12,7 +12,7 @@ describe.win('util: resolve windows', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('should format windows path', () => {
|
test('should format windows path', () => {
|
||||||
expect(wChunk('nuxt/layout/test')).toEqual('nuxt_layout_test')
|
expect(wChunk('nuxt/layout/test')).toEqual('nuxt/layout/test')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('should resolve alias path', () => {
|
test('should resolve alias path', () => {
|
||||||
|
@ -5,7 +5,6 @@ import { loadFixture, getPort, Nuxt } from '../utils'
|
|||||||
|
|
||||||
let nuxt = null
|
let nuxt = null
|
||||||
const readFile = promisify(fs.readFile)
|
const readFile = promisify(fs.readFile)
|
||||||
const isWindows = process.platform.startsWith('win')
|
|
||||||
|
|
||||||
describe('extract css', () => {
|
describe('extract css', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
@ -17,7 +16,7 @@ describe('extract css', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('Verify global.css has been extracted and minified', async () => {
|
test('Verify global.css has been extracted and minified', async () => {
|
||||||
const fileName = isWindows ? 'pages_index.css' : 'pages/index.css'
|
const fileName = 'pages/index.css'
|
||||||
const extractedIndexCss = resolve(__dirname, '..', 'fixtures/extract-css/.nuxt/dist/client', fileName)
|
const extractedIndexCss = resolve(__dirname, '..', 'fixtures/extract-css/.nuxt/dist/client', fileName)
|
||||||
const content = await readFile(extractedIndexCss, 'utf-8')
|
const content = await readFile(extractedIndexCss, 'utf-8')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user