Closed Elanza-48 closed 4 months ago
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 https://github.com/evanw/esbuild/issues/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-esbuild
branch) and I can confirm @Elanza-48's observations:
import.meta.url
is undefined
when using esbuild-loader but works fine using babelfoo.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!
My info:
"esbuild-loader": "^4.2.2", "webpack": "^5.93.0",
This is a closed issue because a minimal reproduction was not provided.
Please open a new issue if it's a verified bug.
For help, you can join my sponsorship program.
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