Skip to content

Commit

Permalink
fix: remove virtual module prefix while generating manifest (#6225)
Browse files Browse the repository at this point in the history
  • Loading branch information
sibbng committed Dec 22, 2021
1 parent 20586f0 commit d51259b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion packages/playground/legacy/__tests__/legacy.spec.ts
@@ -1,4 +1,4 @@
import { isBuild, untilUpdated } from '../../testUtils'
import { isBuild, readManifest, untilUpdated } from '../../testUtils'

test('should work', async () => {
expect(await page.textContent('#app')).toMatch('Hello')
Expand Down Expand Up @@ -44,3 +44,13 @@ test('generates assets', async () => {
true
)
})

if (isBuild) {
test('should generate correct manifest', async () => {
const manifest = readManifest()
expect(manifest['../../../vite/legacy-polyfills']).toBeDefined()
expect(manifest['../../../vite/legacy-polyfills'].src).toBe(
'../../../vite/legacy-polyfills'
)
})
}
1 change: 1 addition & 0 deletions packages/playground/legacy/vite.config.js
Expand Up @@ -10,6 +10,7 @@ module.exports = {
],

build: {
manifest: true,
rollupOptions: {
output: {
chunkFileNames(chunkInfo) {
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/manifest.ts
Expand Up @@ -41,7 +41,7 @@ export function manifestPlugin(config: ResolvedConfig): Plugin {
const ext = path.extname(name)
name = name.slice(0, -ext.length) + `-legacy` + ext
}
return name
return name.replace(/\0/g, '')
} else {
return `_` + path.basename(chunk.fileName)
}
Expand Down

0 comments on commit d51259b

Please sign in to comment.