You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into this issue as well but I think it's possibly indicative of a broader issue. @privatenumber can I ask, does esbuild-loader/esbuild support this webpack new Worker paradigm? Based on evanw/esbuild#312 I think the answer is "not yet"?
To check, I cloned someone's minimal repo showing how to use WebWorkers with TypeScript and plain Webpack+Babel (main master branch of https://github.com/fasiha/web-worker-ts-webpack-test), and tried removing Babel and using esbuild-loader instead (in testing-esbuildbranch) and I can confirm @Elanza-48's observations:
import.meta.url is undefined when using esbuild-loader but works fine using babel
the WebWorker itself doesn't work using esbuild-loader but again worked fine using babel. In fact, with esbuild-loader, it looks like the WebWorker's code in foo.worker.ts is never transpiled, since I can't find the text snippet inside it (42 WAS HERE) anywhere in the built output.
If the answer is "esbuild & esbuild-loader don't support Webpack WebWorkers" then this all makes sense and I'm sorry for making noise!
Problem
When using with webpack5 having web worker, the
import.meta
is coming empty. So creating new web worker object is failing.Expected behavior
import.meta
should not be empty.Minimal reproduction URL
private project
Version
v4.1.0
Node.js version
v18.19.1
Package manager
npm
Operating system
Windows
Contributions
The text was updated successfully, but these errors were encountered: