-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Description
Bug report
Check out this Glitch example with a simplified repro: https://glitch.com/edit/#!/grass-northern-xenon
Here, I'm using a Worker that shares some code with the main thread, but I'm also using sideEffects: false in package.json.
(In the original code the latter is auto-generated by 3rd-party tooling, but it's not important)
What is the current behavior?
The main thread is bundled correctly, but the import in the Worker resolves to undefined and throws when optimizations are enabled.
This doesn't happen when I change sideEffects to true. Maybe this makes it somehow expected behaviour, but it seems odd that Worker code is still correctly included (after all, the only purpose of Workers is to perform side-effects), it's just the import that doesn't resolve.
What is the expected behavior?
The import in Worker should resolve to actual function foo.
Other relevant information:
webpack version: 5.21.2