diff --git a/playground/legacy/__tests__/legacy.spec.ts b/playground/legacy/__tests__/legacy.spec.ts index 290f6b69ac1cf9..ab273e224f7aed 100644 --- a/playground/legacy/__tests__/legacy.spec.ts +++ b/playground/legacy/__tests__/legacy.spec.ts @@ -88,6 +88,7 @@ describe.runIf(isBuild)('build', () => { expect(manifest['../../vite/legacy-polyfills-legacy'].src).toBe( '../../vite/legacy-polyfills-legacy', ) + expect(manifest['custom-legacy.js'].file).toMatch(/chunk-X-legacy.\w{8}.js/) // modern polyfill expect(manifest['../../vite/legacy-polyfills']).toBeDefined() expect(manifest['../../vite/legacy-polyfills'].src).toBe( diff --git a/playground/legacy/custom.js b/playground/legacy/custom.js new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/playground/legacy/main.js b/playground/legacy/main.js index 91ba0b038104c4..bf1fa7e1120fc2 100644 --- a/playground/legacy/main.js +++ b/playground/legacy/main.js @@ -3,6 +3,7 @@ import viteSvgPath from './vite.svg' import MyWorker from './worker?worker' async function run() { + await import('./custom.js') const { fn } = await import('./async.js') fn() } diff --git a/playground/legacy/vite.config.js b/playground/legacy/vite.config.js index 7adf0f784eeeb2..d039799227dab1 100644 --- a/playground/legacy/vite.config.js +++ b/playground/legacy/vite.config.js @@ -23,6 +23,8 @@ module.exports = { chunkFileNames(chunkInfo) { if (chunkInfo.name === 'immutable-chunk') { return `assets/${chunkInfo.name}.js` + } else if (chunkInfo.name === 'custom') { + return 'assets/chunk-X.[hash].js' } return `assets/chunk-[name].[hash].js` },