Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Bug】woker文件路径找不到 #1633

Open
UnicornZhang opened this issue Oct 12, 2024 · 4 comments
Open

【Bug】woker文件路径找不到 #1633

UnicornZhang opened this issue Oct 12, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@UnicornZhang
Copy link

问题:当配置outputPath为多层路径的情况下,worker文件会构建到outputPath下,此时worker文件会找不到,因为worker的路径不受publicPath的影响
Uploading image.png…
umi:v4.3.25

@UnicornZhang
Copy link
Author

图片传不上来,使用umi搭建的项目,配置为 base: '/test/',
publicPath: '/test/static/',
outputPath: 'dist/static/',

@sorrycc sorrycc added the bug Something isn't working label Oct 14, 2024
@hualigushi
Copy link
Contributor

github代码: https://github.com/hualigushi/umi-mako-issue1633
mako 下worker 文件有打包,只是名称不一样
截屏2024-10-15 14 50 04

@UnicornZhang
Copy link
Author

UnicornZhang commented Oct 16, 2024

@hualigushi
我是意思不是worker文件没有编译进去,而是编译后的路径和实际所在路径不一样,导致
这是编译文件的worker地址: new URL("src_pages_Home_worker-demo_js_q_s57j-worker.js", self.document ? self.document.baseURI : self.location.href
页面加载地址:http://localhost:8000/test/src_pages_Home_worker-demo_js_q_s57j-worker.js
这是实际worker地址:http://localhost:8000/test/static/src_pages_Home_worker-demo_js_q_s57j-worker.js,
编译路径缺失static

@UnicornZhang
Copy link
Author

主要考虑worker文件的编译结果都是相对于document.baseURI,这个在修改了outputPath之后,或者worker文件是三方包内的文件进行二次编译的情况,都会有路径问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants