Skip to content

Commit 55a9cb2

Browse files
renoirbAndarist
andauthored
chore(babel): add deprecation/migration warnings for the runtime (#534)
* docs(babel): Add warning to tell about configuration name change runtimeHelpers -> babelHelpers This was figured out after hours of poking. * docs(babel): Tweak deprecation warnings about runtimeHelpers & externalHelpers options Co-authored-by: Mateusz Burzyński <[email protected]>
1 parent 23df786 commit 55a9cb2

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

packages/babel/src/index.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,26 @@ const unpackOptions = ({
2929
};
3030
};
3131

32+
const warnAboutDeprecatedHelpersOption = ({ deprecatedOption, suggestion }) => {
33+
// eslint-disable-next-line no-console
34+
console.warn(
35+
`\`${deprecatedOption}\` has been removed in favor a \`babelHelpers\` option. Try changing your configuration to \`${suggestion}\`. ` +
36+
`Refer to the documentation to learn more: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers`
37+
);
38+
}
39+
3240
const unpackInputPluginOptions = ({ skipPreflightCheck = false, ...rest }, rollupVersion) => {
33-
if (!rest.babelHelpers) {
41+
if ('runtimeHelpers' in rest) {
42+
warnAboutDeprecatedHelpersOption({
43+
deprecatedOption: 'runtimeHelpers',
44+
suggestion: `babelHelpers: 'runtime'`
45+
});
46+
} else if ('externalHelpers' in rest) {
47+
warnAboutDeprecatedHelpersOption({
48+
deprecatedOption: 'externalHelpers',
49+
suggestion: `babelHelpers: 'external'`
50+
});
51+
} else if (!rest.babelHelpers) {
3452
// eslint-disable-next-line no-console
3553
console.warn(
3654
"babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: " +

0 commit comments

Comments
 (0)