Skip to content

Implement bundle with babel core-js@3#1553

Merged
wdh2100 merged 1 commit into
gregnb:masterfrom
wdh2100:babel/add-core-js@3
Nov 3, 2020
Merged

Implement bundle with babel core-js@3#1553
wdh2100 merged 1 commit into
gregnb:masterfrom
wdh2100:babel/add-core-js@3

Conversation

@wdh2100
Copy link
Copy Markdown
Collaborator

@wdh2100 wdh2100 commented Oct 21, 2020

  • add @babel/runtime-corejs3
  • add core-js

This PR added the process of inserting core-js during build and transpiling.

I want to show it as CodeSansBox, but CodeSandBox is not support IE
So you have to check it locally.
I've tested it in Chrome and IE.

Solved to fix this #835

I think... It seems to be insufficient, but there is no problem with the build and transpiling.

thanks!

ref :

 - add @babel/runtime-corejs3
 - add core-js
Comment thread examples/Router/index.js

var returnHomeStyle = { padding: '0px', margin: '20px 0 20px 0' };

return (
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as-is

return <main>
             ....
       </main>

to-be

return  ( 
           <main
            ...
           </main>
)


// get data
getData = (url, page) => {
getData = async (url, page) => {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add async await

Comment thread package.json
"sinon": "^7.4.2",
"style-loader": "^1.2.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move package (dev)

Comment thread package.json
Comment on lines +44 to +45
"@babel/plugin-transform-async-to-generator": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.1",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add

Comment thread package.json
"react-dom": "^16.8.0"
},
"dependencies": {
"@babel/runtime-corejs3": "^7.12.1",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add

Comment thread webpack.config.js
module.exports = {
entry: {
app: "./examples/Router/index.js"
app: ['core-js/stable', 'regenerator-runtime/runtime', './examples/Router/index.js'],
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert entry

Comment thread .eslintrc
"settings": {
"import/extensions": [".js"],
"react": {
"version": "latest"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add version

Comment thread .babelrc
Comment on lines +46 to +51
"@babel/plugin-transform-runtime",
{
"corejs": 3,
"regenerator": true
}
]
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set core-js

Comment thread .babelrc
Comment on lines +14 to +27
"browsers": [
"ie >= 11",
"> 1%",
"iOS >= 8",
"Android >= 4"
],
"node": "6.10"
},
"useBuiltIns": "usage",
"debug": false,
"modules": false,
"corejs": {
"version": 3,
"proposals": true
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set core-js

@patorjk
Copy link
Copy Markdown
Collaborator

patorjk commented Oct 26, 2020

I didn't get a chance to review this but hope to this coming week. Btw, did you see the email I sent you?

@wdh2100 wdh2100 merged commit 08dd2bf into gregnb:master Nov 3, 2020
@wdh2100 wdh2100 deleted the babel/add-core-js@3 branch November 3, 2020 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants