Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-legacy): fail to get the fileName #5250

Merged
merged 3 commits into from
May 15, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/plugin-legacy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ async function buildPolyfillChunk(
}

// add the chunk to the bundle
bundle[polyfillChunk.name] = polyfillChunk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was name always wrong here? Or can we use something like name || fileName 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect the bundle's key to be fileName, because rollup.d.ts is written that way. In fact it's pretty much what I expected, except for 'polyfills-legacy ' chunk. see:
print: assets [
'assets/index-legacy.fc12ec77.js',
'assets/vendor-legacy.2384e447.js',
'polyfills-legacy',
'assets/cut.bd8e1359.png',
'assets/index.4f943797.js',
'assets/vendor.92adb1a9.js',
'assets/vendor.6ff1d4f6.css',
'assets/index.1a175568.css',
'index.html'
]
code: writeBundle(options, bundle) {
Object.keys(bundle).map(fileName => {
// fileName.startsWith('assets') &&
assets.push(fileName)
// assets.push(bundle[fileName].fileName)
})
},
closeBundle() {
console.log('assets', assets)
}

bundle[polyfillChunk.fileName] = polyfillChunk
}

const polyfillId = 'vite/legacy-polyfills'
Expand Down