Closed huyansheng3 closed 3 years ago
rewritePublicPath.js
__webpack_public_path__ = '/';
import './rewritePublicPath.js'
// import UpgradeSharedWorker from './upgrade-notify.sharedworker.js';
https://github.com/webpack-contrib/worker-loader/issues/281 this can fix the problem, maybe is not a good solution.
What is webpack version?
wepack 4.x or 5.x has the same problem .
I just modify the project test case; then see the /outputs content @alexander-akait
you don't need this loader for webpack v5
We describe it in our readme https://github.com/webpack-contrib/worker-loader#readme
oader.option.publicPath only add to the webpack output.publicPath, can only set the worker.js full public path
@alexander-akait just a note: AFAIK Webpack 5 implementation of the loading mechanism doesn't support setting publicPath
specific only to web-workers. It will always use whatever is set in output.publicPath
(which might not be the same path you need for the worker).
when i run the test case, .chunk.js use the loader.option.publicPath, but the .worker.js do not use the loader.option.publicPath
http://localhost:5000/public-path-static456/worker.9ce1180cb43e7000b1a2.worker.js
should be/public-path-static123/worker.9ce1180cb43e7000b1a2.worker.js
?