fix(plugin-legacy): fail to get the fileName#5250
Conversation
fileName could not be obtained in the bundle argument of the writeBundle hook, see: https://rollupjs.org/guide/en/#writebundle
| } | ||
|
|
||
| // add the chunk to the bundle | ||
| bundle[polyfillChunk.name] = polyfillChunk |
There was a problem hiding this comment.
Was name always wrong here? Or can we use something like name || fileName 🤔
There was a problem hiding this comment.
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)
}
fileName could not be obtained in the bundle argument of the writeBundle hook, see: https://rollupjs.org/guide/en/#writebundle
Description
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).