From dd5c27e53d14b8c7be88a26994e19e33c09a68cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rouven=20We=C3=9Fling?= Date: Tue, 17 Nov 2020 12:33:18 +0100 Subject: [PATCH] Use external @babel/runtime helpers Fixes #302 --- package.json | 2 ++ rollup.config.js | 28 +++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 10ea8ab..63e259a 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "devDependencies": { "@babel/cli": "^7.0.0", "@babel/core": "^7.0.0", + "@babel/preset-react": "^7.12.5", "@rollup/plugin-babel": "^5.2.1", "@types/react": "^16.14.5", "babel-loader": "^8.0.0", @@ -79,6 +80,7 @@ "scrollspy" ], "dependencies": { + "@babel/runtime": "^7.12.5", "consolidated-events": "^1.1.0 || ^2.0.0", "prop-types": "^15.0.0", "react-is": "^17.0.1" diff --git a/rollup.config.js b/rollup.config.js index 8f99d2b..0b06ec0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,4 +1,4 @@ -import babel from '@rollup/plugin-babel'; +import babel, { getBabelOutputPlugin } from '@rollup/plugin-babel'; import pkg from './package.json'; export default [ @@ -9,12 +9,34 @@ export default [ ...Object.keys(pkg.peerDependencies), ], output: [ - { file: pkg.main, format: 'cjs' }, - { file: pkg.module, format: 'es' }, + { + file: pkg.main, + format: 'cjs', + plugins: [getBabelOutputPlugin({ + presets: [['airbnb', { + modules: false, + runtimeVersion: '7.12.5', + runtimeHelpersUseESModules: false, + }]], + })], + }, + { + file: pkg.module, + format: 'es', + plugins: [getBabelOutputPlugin({ + presets: [['airbnb', { + modules: false, + runtimeVersion: '7.12.5', + runtimeHelpersUseESModules: true, + }]], + })], + }, ], plugins: [ babel({ + babelrc: false, babelHelpers: 'bundled', + presets: ['@babel/preset-react'], exclude: ['node_modules/**'], }), ],