Skip to content

fix: generate correct worker expression with trusted types#8143

Merged
LingyuCoder merged 1 commit intomainfrom
fix/trusted-type-with-worker
Oct 18, 2024
Merged

fix: generate correct worker expression with trusted types#8143
LingyuCoder merged 1 commit intomainfrom
fix/trusted-type-with-worker

Conversation

@LingyuCoder
Copy link
Copy Markdown
Contributor

@LingyuCoder LingyuCoder commented Oct 16, 2024

Summary

fix #8134

When output.trustedTypes is set, the new Worker(new URL(xxx)) should be compiled to new Worker(__webpack_reuqire__.tu(new URL(xxx))), but now it is compiled to new Worker(new URL(__webpack_require__.tu(xxx)))

The webpack-test/configCases/trusted-types/web-worker case can pass because the mock environment does not have trustedTypes.createPolicy so that the __webpack_require__.tu(xxx) will return xxx directly.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link
Copy Markdown

netlify bot commented Oct 16, 2024

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit 5152cd2
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/670f83c3762ee200087817f8
😎 Deploy Preview https://deploy-preview-8143--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack. labels Oct 16, 2024
@LingyuCoder LingyuCoder requested a review from ahabhgk October 17, 2024 10:34
@LingyuCoder LingyuCoder enabled auto-merge (squash) October 17, 2024 10:34
@LingyuCoder LingyuCoder disabled auto-merge October 17, 2024 11:01
@LingyuCoder LingyuCoder merged commit ddd7eb9 into main Oct 18, 2024
@LingyuCoder LingyuCoder deleted the fix/trusted-type-with-worker branch October 18, 2024 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bug in initializing worker script : Failed to construct 'URL': Invalid URL

2 participants