Skip to content

Commit

Permalink
refactor: polyfill load (#475)
Browse files Browse the repository at this point in the history
* refactor: polyfill load

* chore: bump version

* chore: add esModule false for mini-css-extract-plugin
  • Loading branch information
SoloJiang authored Nov 12, 2020
1 parent 40f908a commit 01d61b4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 32 deletions.
14 changes: 7 additions & 7 deletions packages/rax-babel-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-babel-config",
"version": "1.0.0",
"version": "1.0.1",
"description": "rax base babel config",
"license": "BSD-3-Clause",
"main": "src/index.js",
Expand All @@ -17,18 +17,18 @@
"@babel/core": "^7.9.6",
"@babel/generator": "^7.6.4",
"@babel/parser": "^7.6.4",
"@babel/plugin-proposal-class-properties": "7.2.0",
"@babel/plugin-proposal-decorators": "7.2.0",
"@babel/plugin-proposal-export-default-from": "7.2.0",
"@babel/plugin-proposal-class-properties": "^7.2.0",
"@babel/plugin-proposal-decorators": "^7.2.0",
"@babel/plugin-proposal-export-default-from": "^7.2.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.2.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "7.2.0",
"@babel/preset-flow": "7.0.0",
"@babel/preset-react": "7.0.0",
"@babel/preset-env": "^7.2.0",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.2.0",
"@babel/traverse": "^7.6.3",
"@babel/types": "^7.6.3",
Expand Down
22 changes: 4 additions & 18 deletions packages/rax-babel-config/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const babelMerge = require('babel-merge');
const defaultOptions = {
jsxPlus: !process.env.DISABLE_JSX_PLUS,
styleSheet: false,
modules: 'auto',
modules: false,
};

let logOnce = true;
Expand All @@ -17,8 +17,7 @@ module.exports = (userOptions = {}) => {
jsxToHtml,
disableRegenerator = false,
// preset-env modules options
modules,
isES6 = false
modules
} = options;

const baseConfig = {
Expand All @@ -27,16 +26,12 @@ module.exports = (userOptions = {}) => {
[
require.resolve('@babel/preset-env'),
{
targets: isES6 ?
['last 1 chrome version', 'node 10'] : {
chrome: '49',
ios: '8',
},
loose: true,
modules,
include: [
'transform-computed-properties',
]
],
exclude: disableRegenerator ? ['transform-regenerator'] : []
},
],
[
Expand All @@ -48,15 +43,6 @@ module.exports = (userOptions = {}) => {
],
],
plugins: [
[
require.resolve('@babel/plugin-transform-runtime'),
{
'corejs': false,
'helpers': false,
'regenerator': !disableRegenerator,
'useESModules': false,
},
],
require.resolve('@babel/plugin-syntax-dynamic-import'),
// Stage 0
require.resolve('@babel/plugin-proposal-function-bind'),
Expand Down
2 changes: 1 addition & 1 deletion packages/rax-jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"dependencies": {
"babel-jest": "^26.1.0",
"jest-transform-css": "^2.0.0",
"rax-babel-config": "^0.1.2"
"build-scripts-config": "^0.1.8"
}
}
4 changes: 2 additions & 2 deletions packages/rax-jest-config/src/babelTransform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const babelJest = require('babel-jest');
const getBabelConfig = require('rax-babel-config');
const { getBabelConfig } = require('build-scripts-config');

const jestBabelConfig = getBabelConfig({ isNode: true });
const jestBabelConfig = getBabelConfig();
module.exports = babelJest.createTransformer(jestBabelConfig);
7 changes: 3 additions & 4 deletions packages/rax-webpack-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-webpack-config",
"version": "1.0.0",
"version": "1.0.1",
"description": "rax base webpack config",
"license": "BSD-3-Clause",
"main": "src/index.js",
Expand All @@ -19,7 +19,7 @@
"babel-runtime-jsx-plus": "^0.1.3",
"case-sensitive-paths-webpack-plugin": "^2.3.0",
"css-hot-loader": "^1.4.4",
"css-loader": "^3.2.0",
"css-loader": "^3.0.0",
"file-loader": "^5.0.2",
"identity-obj-proxy": "^3.0.0",
"image-source-loader": "^0.6.5",
Expand All @@ -39,8 +39,7 @@
"webpack-chain": "^6.5.1",
"webpack-filter-warnings-plugin": "^1.2.1",
"webpack-node-externals": "^1.7.2",
"webpack-simple-progress-plugin": "^0.0.4",
"webpack-sources": "^1.4.3",
"mini-css-extract-plugin": "^0.11.2"
"mini-css-extract-plugin": "^1.0.0"
}
}
3 changes: 3 additions & 0 deletions packages/rax-webpack-config/src/setWebpackLoaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const configCSSRule = (config, style, mode, loaders = [], target) => {
rule
.use('MiniCssExtractPlugin.loader')
.loader(MiniCssExtractPlugin.loader)
.options({
esModule: false
})
.end()
.use('css-loader')
.loader(require.resolve('css-loader'))
Expand Down

0 comments on commit 01d61b4

Please sign in to comment.