Skip to content

Commit

Permalink
chore(babel): add deprecation/migration warnings for the runtime (#534)
Browse files Browse the repository at this point in the history
* 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 <mateuszburzynski@gmail.com>
  • Loading branch information
renoirb and Andarist committed Aug 17, 2020
1 parent 23df786 commit 55a9cb2
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/babel/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,26 @@ const unpackOptions = ({
};
};

const warnAboutDeprecatedHelpersOption = ({ deprecatedOption, suggestion }) => {
// eslint-disable-next-line no-console
console.warn(
`\`${deprecatedOption}\` has been removed in favor a \`babelHelpers\` option. Try changing your configuration to \`${suggestion}\`. ` +
`Refer to the documentation to learn more: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers`
);
}

const unpackInputPluginOptions = ({ skipPreflightCheck = false, ...rest }, rollupVersion) => {
if (!rest.babelHelpers) {
if ('runtimeHelpers' in rest) {
warnAboutDeprecatedHelpersOption({
deprecatedOption: 'runtimeHelpers',
suggestion: `babelHelpers: 'runtime'`
});
} else if ('externalHelpers' in rest) {
warnAboutDeprecatedHelpersOption({
deprecatedOption: 'externalHelpers',
suggestion: `babelHelpers: 'external'`
});
} else if (!rest.babelHelpers) {
// eslint-disable-next-line no-console
console.warn(
"babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: " +
Expand Down

0 comments on commit 55a9cb2

Please sign in to comment.