This repository was archived by the owner on Oct 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 22export default function getBabelConfig ( ) {
33 return {
44 ignore : [ './node_modules' ] ,
5- presets : [ '@babel/preset-env' ] ,
6- // https://stackoverflow.com/questions/33527653/babel-6-regeneratorruntime-is-not-defined
7- plugins : [ '@babel/transform-runtime' ] ,
5+ presets : [
6+ [
7+ '@babel/preset-env' ,
8+ {
9+ targets : {
10+ // Only targeting browsers supporting ES Modules (https://babeljs.io/docs/en/babel-preset-env)
11+ // Why?: https://github.com/babel/babel/issues/9849#issuecomment-592668815
12+ esmodules : true ,
13+ } ,
14+ } ,
15+ ] ,
16+ ] ,
17+ // https://stackoverflow.com/questions/53558916/babel-7-referenceerror-regeneratorruntime-is-not-defined/61517521#61517521
18+ // Unfortunately this plugin requires an external (prod) dependency '@babel/runtime'.
19+ // However the required dependency is also modular and shrinks the bundle size in general due to function reuses.
20+ // (See: https://babeljs.io/docs/en/babel-runtime)
21+ // Note: Required when using "babelHelpers: 'runtime'" in the 'rollup.config.default.js'
22+ // and to support browsers that do not support ES Modules like 'IE11'
23+ // plugins: ['@babel/transform-runtime'],
824 } ;
925}
Original file line number Diff line number Diff line change @@ -14,7 +14,11 @@ export const fileExtensions = ['.ts'];
1414function createBabelConfig ( ) {
1515 // https://github.com/rollup/plugins/tree/master/packages/babel#running-babel-on-the-generated-code
1616 return babel ( {
17- babelHelpers : 'runtime' ,
17+ // 'babelHelpers' option 'runtime' is recommended for libraries.
18+ // However using the 'runtime' options requires an external (prod) dependency ('@babel/runtime') which we want to avoid at this point in time.
19+ // (See: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers)
20+ // Therefore we decided against it and only support browsers that support ES modules.
21+ babelHelpers : 'bundled' ,
1822 comments : false ,
1923 extensions : fileExtensions , // https://github.com/rollup/rollup-plugin-babel/issues/255
2024 ...getBabelConfig ( ) ,
@@ -109,6 +113,7 @@ export function createCommonJSConfig(config) {
109113 output : {
110114 file : config . output ,
111115 format : 'cjs' ,
116+ sourcemap : true ,
112117 } ,
113118 external : config . external ,
114119 plugins : [
You can’t perform that action at this time.
0 commit comments