Skip to content

Commit

Permalink
Merge pull request #1349 from Adslot/fix-regenerator-runtime-esm
Browse files Browse the repository at this point in the history
[ADS-6456] fix: tree shaking & regeneratorRuntime
  • Loading branch information
bchew authored Mar 24, 2022
2 parents ce030aa + b7cd3a7 commit 572e2af
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 2 deletions.
14 changes: 12 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ const env = {
},
esm: {
presets: [['@babel/preset-env', { useBuiltIns: false, modules: false }]],
plugins: ['jsx-remove-data-test-id', inlineSvgPlugin, ['transform-remove-imports', { test: '\\.(scss|css)$' }]],
plugins: [
['@babel/plugin-transform-runtime', { regenerator: true }],
'jsx-remove-data-test-id',
inlineSvgPlugin,
['transform-remove-imports', { test: '\\.(scss|css)$' }],
],
},
cjs: {
presets: [['@babel/preset-env', { useBuiltIns: false, modules: 'cjs' }]],
plugins: ['jsx-remove-data-test-id', inlineSvgPlugin, ['transform-remove-imports', { test: '\\.(scss|css)$' }]],
plugins: [
['@babel/plugin-transform-runtime', { regenerator: true }],
'jsx-remove-data-test-id',
inlineSvgPlugin,
['transform-remove-imports', { test: '\\.(scss|css)$' }],
],
},
};

Expand Down
1 change: 1 addition & 0 deletions config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = webpackMerge(commonConfig, {
},
{
test: /\.((c|sc)ss)$/i,
sideEffects: true,
use: [
'style-loader',
{
Expand Down
1 change: 1 addition & 0 deletions config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ module.exports = webpackMerge(commonConfig, {
},
{
test: /\.((c|sc)ss)$/i,
sideEffects: true,
use: [
MiniCssExtractPlugin.loader,
{
Expand Down
90 changes: 90 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"lib",
"es"
],
"sideEffects": [
"./src/**/*.scss",
"./dist/*.css"
],
"license": "MIT",
"scripts": {
"generate-docs": "node ./scripts/generateDocs.js",
Expand Down Expand Up @@ -71,6 +75,7 @@
"@babel/cli": "^7.17.0",
"@babel/core": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-react": "^7.16.7",
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
Expand Down

0 comments on commit 572e2af

Please sign in to comment.