fix(babel): Pass chunk filename to output plugin transform - #515
fix(babel): Pass chunk filename to output plugin transform#515evocateur wants to merge 1 commit into
Conversation
This appears to be an oversight, as the filename is passed at the same place in the input plugin. Without this, a Babel error including text "Preset /* your preset */ requires a filename to be set when babel is called directly" is thrown when using a custom preset. The test is not ideal, but without replicating a huge stack of other Rollup plugins and complicated Babel config, it's unclear how else to regress this. A local edit of the Rollup Babel plugin in node_modules of the offending build does indicate the error is mitigated, however.
|
Ooh, I think I figured out the trigger, and it's much simpler than I thought: |
|
Additionally, in a repo where The module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
ie: 11,
},
},
],
],
overrides: [
{
test: [
'./src/stuff.js',
'./src/things/*.js',
],
presets: [
[
'@babel/preset-env',
{
exclude: ['@babel/plugin-transform-classes'],
targets: {
node: 'current',
},
},
],
],
},
],
}; |
|
This was not implemented on purpose - see rollup/rollup-plugin-babel#333 (comment) . I'm too tired today to analyze this issue as a whole but maybe you could look at the linked comments to see how this applies to your case (or how it doesn't). |
|
@Andarist Will do, thanks for the pointer! |
|
Well, turns out I was barking up the wrong tree entirely. Output plugins were not the solution, I needed to pass an array of configs from my Thanks for your responsiveness! |
Rollup Plugin Name:
@rollup/plugin-babelThis PR contains:
Are tests included?
Breaking Changes?
If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.
List any relevant issue numbers: N/A
Description
This appears to be an oversight, as the
filenameis passed at the same place in the input plugin transform Babel options. Without this field, a Babel error including text"Preset /* your preset */ requires a filename to be set when babel is called directly"is thrown when using a custom preset.(stack trace is using
@babel/core@7.10.5)The test is not ideal, but without replicating a huge stack of other Rollup plugins and complicated Babel config, it's unclear how else to regress this in a focused, minimal way. A local edit of the Rollup Babel plugin in
node_modulesof the offending build does indicate the error is mitigated, however.