Description
Version
3.0.0-beta.9
Reproduction link
https://github.com/doublemarked/vue-libconf-issues
Steps to reproduce
git clone https://github.com/doublemarked/vue-libconf-issues.git
npm install && npm run build && npm run demo
- Load
http://localhost:8000
- Observe errors in browser console
What is expected?
The library entry code sports the excellent idea of assigning Webpack's publicPath
at runtime to allow modules to be used cross domain / webroot. Per the comments in resolveLibConfig.js:
// use dynamic publicPath so this can be deployed anywhere
// the actual path will be determined at runtime by checking
// document.currentScript.src.
It is expected that the dynamic publicPath
should be resolved early enough to apply to all resource loading.
What is actually happening?
That functionality, implemented in entry-lib.js
, unfortunately does not run early enough to affect resources that are loaded as part of the initial code chunk. It seems to currently only work if you call import()
later, after initial load.
Context: In my real-world project this bug is preventing me from loading CSS in my library and having webpack properly resolve the hostname for the bundled assets (fonts, images, etc).