Answer the question
In order to leave comments, you need to log in
How to use dynamic import of external script?
How to use webpack dynamic import if the script is connected from an external domain.
An external app.js script from the appcdn.com domain connects to
site.com. Dynamic import is used in app.js.
How do I tell webpack when building app.js that chunks should be loaded from appcdn.com?
Answer the question
In order to leave comments, you need to log in
publicPath
Personally, I like the feature __webpack_public_path__
: with the installation of dynamically from document.currentScript
, you can not bathe at all where everything will lie.
But if the addresses will not change, then the static one publicPath
is of course more reliable.
PS Just in case: if several webpack bundles are used on one page, you should not forget to set a unique jsonpFunction for each, otherwise there may be collisions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question