Skip to content

Commit

Permalink
test: use a case to introduce the case when there is no [name]
Browse files Browse the repository at this point in the history
  • Loading branch information
aleen42 committed Jan 6, 2023
1 parent ae3eca3 commit 0087b51
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions playground/legacy/__tests__/legacy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Empty file added playground/legacy/custom.js
Empty file.
1 change: 1 addition & 0 deletions playground/legacy/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
2 changes: 2 additions & 0 deletions playground/legacy/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`
},
Expand Down

0 comments on commit 0087b51

Please sign in to comment.