Skip to content

Commit

Permalink
Change the babel and webpack config to polyfill missing functionality (
Browse files Browse the repository at this point in the history
…#4627)

* Change the babel and webpack config to polyfill missing functionality for the defined babel target

* Fix build error. For some reason "const" is not transpiled

* Only exclude core-js from transpiling
  • Loading branch information
dsilhavy authored Nov 13, 2024
1 parent 8f9a7f3 commit 35699f3
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 142 deletions.
17 changes: 15 additions & 2 deletions build/webpack.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const commonConfig = {
rules: [
{
test: /\.(js)$/,
exclude: [/core-js/],
use: [
{
loader: 'string-replace-loader',
Expand All @@ -19,14 +20,26 @@ const commonConfig = {
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
sourceType: 'unambiguous',
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: '3.39.0',
}
],
],
plugins: [
'@babel/plugin-transform-runtime',
'@babel/plugin-transform-parameters'
],
},
},
],
},
],
},
//Webpack 5 no longer polyfills Node.js core modules automatically
resolve: {
fallback: {
stream: require.resolve('stream-browserify'),
Expand Down
Loading

0 comments on commit 35699f3

Please sign in to comment.