Last active
May 3, 2023 11:16
-
-
Save anthumchris/249d741b64081f88db7938f502855447 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
It actually helped my video.js project to work in IE 11, cheers:heart: