Skip to content

How to add polyfill to currentScript to be compatible with IE #18233

Answered by alexander-akait
zzkkui asked this question in Q&A
Discussion options

You must be logged in to vote

You can just create a simple plugin which add a custom code at the top of your runtime chunk(s), we don't officially support dead browsers (which doesn't support currentScript), IE11 is officialy dead, around 98%-99% users don't need this, the rest are bots and any automation systems (most of them without JS), so you have two solution:

  1. Just add a script tag before webpack code in your HTML file
  2. Use multi compiler mode, i.e.
module.exports = [
 {
   name: "polyfills",
   entry: "./src/polyfills.js",
   target: ["web", "es3"]
   output: {
     // Avoid using `currentScript`
     publicPath: "/"
   }
   // Other options
 },
 {
   name: "application",
   dependecies: ["polyfill"]
   entry: …

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@zzkkui
Comment options

@alexander-akait
Comment options

@zzkkui
Comment options

@alexander-akait
Comment options

Answer selected by zzkkui
@zzkkui
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants