Skip to content

Commit

Permalink
fix: refactor babel setup for core-js polyfl usage
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Apr 2, 2019
1 parent 4c1b2fc commit 1ca48e3
Show file tree
Hide file tree
Showing 8 changed files with 371 additions and 636 deletions.
22 changes: 17 additions & 5 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
module.exports = {
ignore: ['node_modules/**'],
babelrcRoots: ['.', 'packages/*'],
presets: [['@babel/preset-env'], ['@babel/preset-react']],
babelrcRoots: ['packages/examples/**'],
presets: [
[
'@babel/preset-env',
{
debug: false,
targets: {
browsers: ['last 2 versions', 'explorer >= 11']
}
}
],
'@babel/preset-react'
],
plugins: [
['@babel/plugin-proposal-class-properties'],
['@babel/plugin-proposal-object-rest-spread'],
['@babel/plugin-proposal-export-default-from']
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime'
]
}
20 changes: 14 additions & 6 deletions packages/dnb-design-system-portal/.babelrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
{
"presets": [
[
"babel-preset-gatsby",
"@babel/preset-env",
{
"targets": {
"browsers": ["last 2 versions", "explorer >= 11"]
},
"useBuiltIns": "usage",
"corejs": 2
}
]
],
"@babel/preset-react"
],
"plugins": ["emotion"]
"ignore": [
".*node_modules/(?!rewrite-pattern|regexpu-core|buble|react-live).*"
],
"plugins": [
"emotion",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-transform-runtime"
]
}
17 changes: 12 additions & 5 deletions packages/dnb-design-system-portal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,30 @@
"devDependencies": {
"@babel/core": "^7.4.0",
"@babel/node": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/plugin-proposal-export-default-from": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.4.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"@babel/preset-react": "^7.0.0",
"@mdx-js/mdx": "0.20.3",
"@mdx-js/tag": "0.20.3",
"babel-jest": "^24.5.0",
"babel-plugin-emotion": "^10.0.9",
"babel-preset-gatsby": "^0.1.10",
"camelcase": "^5.2.0",
"camelcase": "^5.3.0",
"ci-info": "^2.0.0",
"classnames": "^2.2.6",
"clean-html": "^1.5.0",
"color": "^3.1.0",
"cross-env": "^5.2.0",
"del": "^4.0.0",
"del": "^4.1.0",
"emotion": "^10.0.9",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.11.2",
"enzyme-to-json": "^3.3.5",
"eslint": "^5.15.3",
"eslint": "^5.16.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
Expand All @@ -89,13 +96,13 @@
"gh-pages": "^2.0.1",
"github-slugger": "^1.2.1",
"jest": "^24.5.0",
"jest-css-modules": "^1.1.0",
"jest-css-modules": "^2.0.0",
"jest-emotion": "^10.0.10",
"jest-raw-loader": "^1.0.1",
"keycode": "^2.2.0",
"lint-staged": "^8.1.5",
"nodemon": "^1.18.10",
"ora": "^3.2.0",
"ora": "^3.3.0",
"postcss-preset-env": "^6.6.0",
"prettier": "^1.16.4",
"prettier-package-json": "^2.1.0",
Expand Down
107 changes: 0 additions & 107 deletions packages/dnb-ui-lib/.babelrc

This file was deleted.

1 change: 0 additions & 1 deletion packages/dnb-ui-lib/.browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ edge >= 14
firefox >= 52
chrome >= 49
safari >= 10
node 8.0
91 changes: 91 additions & 0 deletions packages/dnb-ui-lib/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
const production = {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 2
}
],
'@babel/preset-react'
],
ignore: ['node_modules/**', '**/*.test.js'],
plugins: [
'@babel/plugin-transform-react-constant-elements',
'transform-dev-warning',
[
'react-remove-properties',
{
properties: ['data-dnb-test', 'data-dnb-test-wrapper']
}
],
[
'transform-react-remove-prop-types',
{
mode: 'wrap'
}
],
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime'
]
}

module.exports = {
env: {
test: {
presets: [
[
'@babel/preset-env',
{
targets: {
node: '10.6'
}
}
],
'@babel/preset-react'
],
ignore: ['node_modules/**'],
plugins: [
'transform-dynamic-import',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-class-properties'
]
},
development: {
presets: [
[
'@babel/preset-env',
{
targets: {
browsers: 'last 1 versions'
}
}
],
'@babel/preset-react'
],
ignore: ['node_modules/**', '**/*.test.js'],
plugins: [
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-class-properties'
]
},
production,
'production-umd': {
...production,
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 2,
modules: false
}
],
'@babel/preset-react'
]
}
}
}
Loading

0 comments on commit 1ca48e3

Please sign in to comment.