Bump babel to v7

This commit is contained in:
SleepWalker 2019-06-30 18:19:28 +03:00
parent b21f650ec6
commit 4783f1bad0
9 changed files with 1275 additions and 1560 deletions

View File

@ -1,17 +0,0 @@
{
"presets": ["react", "flow", "es2015", "es2017", "stage-0"],
"plugins": [
["transform-runtime", {"polyfill": false}],
"transform-function-bind",
["react-intl", {"messagesDir": "./dist/messages/"}]
],
"env": {
"development": {
"presets": ["react-hmre"]
},
"test": {
// airbnb some how disables stage-0, so forcing it after airbnb
"presets": ["airbnb", "stage-0"]
}
}
}

2
.browserslistrc Normal file
View File

@ -0,0 +1,2 @@
> 0.25%
not dead

39
babel.config.js Normal file
View File

@ -0,0 +1,39 @@
module.exports = {
presets: [
'@babel/preset-react',
'@babel/preset-flow',
['@babel/preset-env']
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-function-bind',
'@babel/plugin-proposal-class-properties',
[
'@babel/plugin-transform-runtime',
{
corejs: 3
}
],
['react-intl', { messagesDir: './dist/messages/' }]
],
env: {
webpack: {
presets: [
[
'@babel/preset-env',
{
modules: false,
useBuiltIns: 'usage', // or "entry"
corejs: 3
}
]
]
},
development: {
presets: []
},
test: {
presets: []
}
}
};

View File

@ -1,3 +0,0 @@
# https://github.com/ai/browserslist#config-file
Last 2 versions

View File

@ -35,7 +35,6 @@
"build:dll": "node ./scripts/build-dll.js" "build:dll": "node ./scripts/build-dll.js"
}, },
"dependencies": { "dependencies": {
"babel-polyfill": "^6.3.14",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"copy-to-clipboard": "^3.0.8", "copy-to-clipboard": "^3.0.8",
"debounce": "^1.0.0", "debounce": "^1.0.0",
@ -62,23 +61,36 @@
"whatwg-fetch": "^3.0.0" "whatwg-fetch": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"babel-cli": "^6.18.0", "@babel/cli": "^7.0.0",
"babel-core": "^6.0.0", "@babel/core": "^7.0.0",
"@babel/node": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/runtime-corejs3": "^7.4.5",
"babel-eslint": "^9.0.0", "babel-eslint": "^9.0.0",
"babel-loader": "^6.0.0", "babel-loader": "^8.0.0",
"babel-plugin-react-intl": "^2.0.0", "babel-plugin-react-intl": "^2.0.0",
"babel-plugin-transform-function-bind": "^6.0.0",
"babel-plugin-transform-runtime": "^6.3.13",
"babel-preset-airbnb": "^2.0.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2017": "^6.16.0",
"babel-preset-flow": "^6.23.0",
"babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.0.1",
"babel-preset-stage-0": "^6.3.13",
"babel-runtime": "^6.0.0",
"bundle-loader": "^0.5.4", "bundle-loader": "^0.5.4",
"check-node-version": "^2.1.0", "check-node-version": "^2.1.0",
"core-js": "3",
"csp-webpack-plugin": "^1.0.2", "csp-webpack-plugin": "^1.0.2",
"css-loader": "^0.28.0", "css-loader": "^0.28.0",
"enzyme": "^3.8.0", "enzyme": "^3.8.0",

View File

@ -1,4 +1,5 @@
import 'babel-polyfill'; import 'core-js/stable';
import 'regenerator-runtime/runtime';
import 'url-search-params-polyfill'; import 'url-search-params-polyfill';
import 'whatwg-fetch'; import 'whatwg-fetch';
import { shim as shimPromiseFinaly } from 'promise.prototype.finally'; import { shim as shimPromiseFinaly } from 'promise.prototype.finally';

View File

@ -33,15 +33,14 @@ export default {
locale: string; locale: string;
messages: { [string]: string }; messages: { [string]: string };
}> { }> {
const promises: Array<Promise<*>> = [ const promises: Array<Promise<any>> = [
new Promise(require(`bundle-loader?name=[name]!react-intl/locale-data/${locale}.js`)), import(/* webpackChunkName: "[request]-locale" */`react-intl/locale-data/${locale}.js`),
new Promise(require(`bundle-loader?name=[name]!i18n/${locale}.json`)) import(/* webpackChunkName: "[request]-locale" */`i18n/${locale}.json`),
]; ];
if (needPolyfill) { if (needPolyfill) {
// $FlowFixMe promises.push(import(/* webpackChunkName: "[request]-intl-polyfill" */ 'intl'));
promises.push(new Promise(require('bundle-loader?name=intl!intl'))); promises.push(import(/* webpackChunkName: "[request]-intl-polyfill" */`intl/locale-data/jsonp/${locale}.js`));
promises.push(new Promise(require(`bundle-loader?name=[name]-polyfill-data!intl/locale-data/jsonp/${locale}.js`)));
} }
return Promise.all(promises) return Promise.all(promises)

View File

@ -1,6 +1,6 @@
/* eslint-env node */ /* eslint-env node */
require('babel-register'); require('@babel/register');
const path = require('path'); const path = require('path');
@ -190,7 +190,15 @@ const webpackConfig = {
{ {
test: /\.jsx?$/, test: /\.jsx?$/,
exclude: /node_modules/, exclude: /node_modules/,
loader: 'babel-loader?cacheDirectory=true' use: [
{
loader: 'babel-loader',
options: {
envName: 'webpack',
cacheDirectory: true
}
}
]
}, },
{ {
test: /\.(png|gif|jpg|svg)$/, test: /\.(png|gif|jpg|svg)$/,
@ -274,7 +282,6 @@ if (isProduction) {
if (!isProduction && !isTest) { if (!isProduction && !isTest) {
webpackConfig.plugins.push( webpackConfig.plugins.push(
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
); );
if (config.apiHost) { if (config.apiHost) {

2707
yarn.lock

File diff suppressed because it is too large Load Diff