Skip to content

Commit 08dd2bf

Browse files
authored
Merge pull request #1553 from wdh2100/babel/add-core-js@3
Implement bundle with babel core-js@3
2 parents 1edfd40 + 1088513 commit 08dd2bf

File tree

7 files changed

+760
-1441
lines changed

7 files changed

+760
-1441
lines changed

.babelrc

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,53 @@
11
{
22
"env": {
33
"test": {
4-
"plugins": ["istanbul"]
4+
"plugins": [
5+
"istanbul"
6+
]
57
}
68
},
79
"presets": [
8-
"@babel/react",
9-
["@babel/env", {
10-
"targets": {
11-
"browsers": ["> 1%", "iOS >= 8", "Android >= 4"],
12-
"node": "6.10"
13-
},
14-
"debug": false
15-
}]
10+
[
11+
"@babel/preset-env",
12+
{
13+
"targets": {
14+
"browsers": [
15+
"ie >= 11",
16+
"> 1%",
17+
"iOS >= 8",
18+
"Android >= 4"
19+
],
20+
"node": "6.10"
21+
},
22+
"useBuiltIns": "usage",
23+
"debug": false,
24+
"modules": false,
25+
"corejs": {
26+
"version": 3,
27+
"proposals": true
28+
}
29+
}
30+
],
31+
[
32+
"@babel/preset-react"
33+
]
1634
],
1735
"plugins": [
18-
"@babel/plugin-proposal-class-properties",
19-
"@babel/plugin-proposal-object-rest-spread"
36+
[
37+
"@babel/plugin-proposal-class-properties"
38+
],
39+
[
40+
"@babel/plugin-proposal-object-rest-spread"
41+
],
42+
[
43+
"@babel/plugin-transform-async-to-generator"
44+
],
45+
[
46+
"@babel/plugin-transform-runtime",
47+
{
48+
"corejs": 3,
49+
"regenerator": true
50+
}
51+
]
2052
]
2153
}

.eslintrc

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
{
22
"parser": "babel-eslint",
33
"settings": {
4-
"import/extensions": [".js"],
4+
"react": {
5+
"version": "latest"
6+
},
7+
"import/extensions": [
8+
".js"
9+
],
510
"import/parser": "babel-eslint",
611
"import/resolver": {
712
"node": {
8-
"extensions": [".js"]
13+
"extensions": [
14+
".js"
15+
]
916
},
1017
"webpack": {
1118
"config": "webpack.config.js"
@@ -19,7 +26,7 @@
1926
"ecmaFeatures": {
2027
"jsx": true,
2128
"experimentalObjectRestSpread": true
22-
},
29+
}
2330
},
2431
"env": {
2532
"es6": true,
@@ -28,7 +35,7 @@
2835
"node": true
2936
},
3037
"extends": [
31-
"plugin:jsx-a11y/recommended"
38+
"plugin:jsx-a11y/recommended"
3239
],
3340
"rules": {
3441
"no-console": "off",
@@ -41,9 +48,12 @@
4148
"react/jsx-no-duplicate-props": "warn",
4249
"react-hooks/rules-of-hooks": "error",
4350
"react-hooks/exhaustive-deps": "warn",
44-
"jsx-a11y/no-autofocus": [ 2, {
45-
"ignoreNonDOM": true
46-
}]
51+
"jsx-a11y/no-autofocus": [
52+
2,
53+
{
54+
"ignoreNonDOM": true
55+
}
56+
]
4757
},
4858
"plugins": [
4959
"import",

examples/Router/index.js

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,62 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import {HashRouter as Router, Route, Switch} from 'react-router-dom';
4-
import {withStyles} from "@material-ui/core/styles/index";
5-
import ExamplesGrid from "./ExamplesGrid";
6-
import examples from "../examples";
7-
import Button from "@material-ui/core/Button";
8-
import {withRouter} from 'react-router-dom';
3+
import { HashRouter as Router, Route, Switch } from 'react-router-dom';
4+
import { withStyles } from '@material-ui/core/styles/index';
5+
import ExamplesGrid from './ExamplesGrid';
6+
import examples from '../examples';
7+
import Button from '@material-ui/core/Button';
8+
import { withRouter } from 'react-router-dom';
99

1010
const styles = {
11-
root: {
12-
display: 'flex',
13-
justifyContent: 'center',
14-
},
15-
contentWrapper: {
16-
width: '100%',
17-
},
11+
root: {
12+
display: 'flex',
13+
justifyContent: 'center',
14+
},
15+
contentWrapper: {
16+
width: '100%',
17+
},
1818
};
1919

2020
class Examples extends React.Component {
21+
returnHome = () => {
22+
this.props.history.push('/');
23+
};
2124

22-
returnHome = () => {
23-
this.props.history.push('/');
24-
};
25-
26-
render() {
27-
const {classes} = this.props;
28-
29-
var returnHomeStyle = {padding:'0px', margin:'20px 0 20px 0'};
30-
31-
return <main className={classes.root}>
32-
<div className={classes.contentWrapper}>
33-
<Switch>
34-
<Route path="/" exact render={() => <ExamplesGrid examples={examples}/>}/>
35-
{Object.keys(examples).map((label, index) => (
36-
<Route key={index} path={`/${label.replace(/\s+/g, '-').toLowerCase()}`} exact component={examples[label]}/>
37-
))}
38-
</Switch>
39-
<div>
40-
{this.props.location.pathname !== '/' && (
41-
<div style={returnHomeStyle}>
42-
<Button color="primary" onClick={this.returnHome}>Back to Example Index</Button>
43-
</div>
44-
)}
45-
</div>
46-
</div>
47-
</main>;
48-
}
25+
render() {
26+
const { classes } = this.props;
27+
28+
var returnHomeStyle = { padding: '0px', margin: '20px 0 20px 0' };
29+
30+
return (
31+
<main className={classes.root}>
32+
<div className={classes.contentWrapper}>
33+
<Switch>
34+
<Route path="/" exact render={() => <ExamplesGrid examples={examples} />} />
35+
{Object.keys(examples).map((label, index) => (
36+
<Route
37+
key={index}
38+
path={`/${label.replace(/\s+/g, '-').toLowerCase()}`}
39+
exact
40+
component={examples[label]}
41+
/>
42+
))}
43+
</Switch>
44+
<div>
45+
{this.props.location.pathname !== '/' && (
46+
<div style={returnHomeStyle}>
47+
<Button color="primary" onClick={this.returnHome}>
48+
Back to Example Index
49+
</Button>
50+
</div>
51+
)}
52+
</div>
53+
</div>
54+
</main>
55+
);
56+
}
4957
}
5058

51-
const StyledExamples = withRouter( withStyles(styles)(Examples) );
59+
const StyledExamples = withRouter(withStyles(styles)(Examples));
5260

5361
function App() {
5462
return (
@@ -58,4 +66,4 @@ function App() {
5866
);
5967
}
6068

61-
ReactDOM.render(<App/>, document.getElementById('app-root'));
69+
ReactDOM.render(<App />, document.getElementById('app-root'));

0 commit comments

Comments
 (0)