0

After upgrade webpack from version 4 to 5 I have problem with IE 11. I have all chunks in path '/' and I have one script with code:

var url = './assets/js/vendor/library/lib.js'
var script = document.createElement('script')
script.src = url
script.async = true
document.getElementsByTagName('head')[0].appendChild(script)

After executing the above code, the browser starts trying to fetch chunks from the path '/assets/js/vendor/library/chunk.js', not from '/chunk.js' even lib.js is empty file. In Chrome everything works fine. When I comment on the above code, everything starts to work.

Variable window.location.pathname is setted correctly to '/'.

Rafał S.
  • 27
  • 4
  • 1
    Have you upgrade webpack from 4 to 5 according to [this](https://stackoverflow.com/questions/64478671/after-build-via-webpack-5-app-stoped-working-on-internet-explorer-ie11/64494479#64494479)? Please also try to clear IE cache and test again. Besides, I find [a similar thread](https://stackoverflow.com/questions/38976282/webpack-new-chunk-is-loading-in-with-wrong-path) and you can refer to it. If the issue still exists, please provide a minimal code snippet or steps to reproduce the issue. – Yu Zhou Jul 12 '21 at 07:36
  • Problem was missing output.publicPath in webpack configuration. – Rafał S. Jul 12 '21 at 12:36
  • I'm glad that you have solved the issue. You can put the solution into an answer and mark it as an accepted answer. It can help other community members in future in similar kind of issues. Thanks for your understanding. – Yu Zhou Jul 13 '21 at 01:39

0 Answers0