Closed
Description
Version
3.0.0-beta.5
Reproduction link
https://github.com/batje/asyncwcpath
Steps to reproduce
- Compile at least 2 components with --target wc-async
- copy dist/demo.html to src/demo.html
- in src/demo.html change the path to your component.js by adding ../dist/
- load src/demo.html in your browser.
- component.js will load, but component.1.js will fail
What is expected?
component.1.js should be loaded from a path relative to component.js, not relative to the demo.html file.
What is actually happening?
This line
sets publicpath to './' which causes webpack to look for the second file relative to the html file, not the .js file.
Better would be to
- default to './'
- add a new command-prompt option called 'libpath' that you can set to a path like the examples in the webpack documentation
- if 'libpath' equals 'RUNTIME' do not fill in publicpath and allow setting the variable at runtime. eg: webpack_public_path = myRuntimePublicPath
Documentation for this option is here:
https://webpack.js.org/configuration/output/#output-publicpath