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

import meta empty object #372

Closed
2 tasks
Elanza-48 opened this issue May 15, 2024 · 2 comments
Closed
2 tasks

import meta empty object #372

Elanza-48 opened this issue May 15, 2024 · 2 comments
Labels
bug Something isn't working pending triage

Comments

@Elanza-48
Copy link

Elanza-48 commented May 15, 2024

Problem

When using with webpack5 having web worker, the import.meta is coming empty. So creating new web worker object is failing.
Capture

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

  • I plan to open a pull request for this issue
  • I plan to make a financial contribution to this project
@Elanza-48 Elanza-48 added bug Something isn't working pending triage labels May 15, 2024
@privatenumber privatenumber closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2024
@fasiha
Copy link

fasiha commented Aug 1, 2024

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-esbuild branch) and I can confirm @Elanza-48's observations:

  1. import.meta.url is undefined when using esbuild-loader but works fine using babel
  2. 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!

My info:

@privatenumber
Copy link
Owner

privatenumber commented Aug 2, 2024

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.

Repository owner locked and limited conversation to collaborators Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working pending triage
Projects
None yet
Development

No branches or pull requests

3 participants