-
-
Save Aha00a/ab5a652503ca450d74f00bec6751aa77 to your computer and use it in GitHub Desktop.
Use Webpack 5 and Babel 7 to create JavaScript bundle for Internet Explorer 11 (IE11, IE 11)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default 'Hello!' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Test file for IE 11 that uses modern JavaScript | |
| */ | |
| import greeting from './Greeting' | |
| window.addEventListener('load', async () => { | |
| const o = { | |
| greeting: await Promise.resolve(greeting) | |
| } | |
| console.log( | |
| o, | |
| Object.entries(o), | |
| Object.keys(o), | |
| Object.values(o), | |
| ) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "browserslist": [ | |
| "ie 11" | |
| ], | |
| "scripts": { | |
| "dev": "webpack -w", | |
| "build": "webpack" | |
| }, | |
| "devDependencies": { | |
| "@babel/core": "^7.12.9", | |
| "@babel/preset-env": "^7.12.7", | |
| "babel-loader": "^8.2.2", | |
| "core-js": "^3.8.0", | |
| "webpack": "^5.8.0", | |
| "webpack-cli": "^4.2.0" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| entry: './index.js', | |
| module: { | |
| rules: [{ | |
| test: /\.m?js$/, | |
| exclude: /node_modules/, | |
| use: { | |
| loader: 'babel-loader', | |
| options: { | |
| presets: [ | |
| ['@babel/preset-env', { | |
| useBuiltIns: 'usage', | |
| corejs: 3 | |
| }] | |
| ] | |
| } | |
| } | |
| }] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment