How to add polyfill to currentScript to be compatible with IE #18233
-
and then I added currentScript polyfill to entry: {
main:[path.join(__dirname, '../src/util/currentScript.js'), path.join(__dirname, '../src/index.jsx')],
} But the built file first executes webpack runtime, and then executes the currentScript polyfill. so there is a problem. Document.currentScript is used in the webpack runtime. In IE, because the webpack runtime is executed first, and the currentScript polyfill is executed later, we get The publicPath is wrong. I tried to execute the currentScript polyfill before webpack runtime in the built file. This can introduce static files normally in IE, so there should be no problem with currentScript polyfill, but it should be inserted and executed before webpack runtime. Is there any configuration method to make currentScript polyfill execute before webpack runtime? Anyway looking forward to reply, thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
The result of my build is that a js is referenced by other js, without html |
Beta Was this translation helpful? Give feedback.
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:script
tag before webpack code in your HTML file