Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only target esmodules when transpiling packages, then use browserlist…
Browse files Browse the repository at this point in the history
… when building bundles
afharo committed Apr 26, 2022
1 parent 1cce4d7 commit 288e124
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions packages/kbn-babel-preset/webpack_preset.js
Original file line number Diff line number Diff line change
@@ -14,11 +14,15 @@ module.exports = (_, options = {}) => {
[
require.resolve('@babel/preset-env'),
{
targets: {
esmodules: true,
},
...(options.esmodules === false
? {}
: {
targets: {
esmodules: true,
},
modules: false,
}),
useBuiltIns: 'entry',
modules: false,
// Please read the explanation for this
// in node_preset.js
corejs: '3.21.1',
4 changes: 2 additions & 2 deletions packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
@@ -219,8 +219,8 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker:
babelrc: false,
envName: worker.dist ? 'production' : 'development',
presets: IS_CODE_COVERAGE
? [ISTANBUL_PRESET_PATH, BABEL_PRESET_PATH]
: [BABEL_PRESET_PATH],
? [ISTANBUL_PRESET_PATH, [BABEL_PRESET_PATH, { esmodules: false }]]
: [[BABEL_PRESET_PATH, { esmodules: false }]],
},
},
},

0 comments on commit 288e124

Please sign in to comment.