Lucas Garron

Results 696 comments of Lucas Garron

By any chance, could there be a simple way to get parts of the codebase to essentially treat each other as external? e.g. pretend that each folder index entry point...

> ```js > ```js > new Worker( new URL( "./worker", import.meta.url ), { type: "module" } ) > ``` > > > > This is my current plan to support...

I started trying to figure out how to implement this by mirroring dynamic imports e.g. [here](https://github.com/evanw/esbuild/blob/cd5597d0964305a5d910342ac790fc38cbe7f407/pkg/api/api_impl.go#L1451) and [here](https://github.com/evanw/esbuild/blob/cd5597d0964305a5d910342ac790fc38cbe7f407/internal/ast/ast.go#L22). I also started trying to detect the `new Worker(...)` AST pattern at...

> @evanw, do you have any thoughts on how to structure a PR so that this pattern works? *poke* It looks like the main person working on this for Firefox...

So, I've spent a lot of time on figure out workarounds, and if you're all-in on ESM then I think the following is the simplest solution with clear semantics that...

> It works today, but it's pretty unfortunate that it doesn't support the same convention chosen by most other popular bundlers, that also works directly in browsers. It makes it...

@evanw What are the chances that `esbuild` could support `new URL("./worker.js", import.meta.url)` as in this? ```js // index.js const workerURL = new URL("./worker.js", import.meta.url); const blob = new Blob([`import "${workerURL}";`],...

> I've [just learned](https://github.com/parcel-bundler/parcel/issues/7623#issuecomment-1025389625) that apparently all other major bundlers support the relative path resolution of other source entry files like in the snippet above. Just to expand on this,...

> FWIW in your last snippet the Blob URL is not required either. How do you mean? I don't know of anything else (or at least anything simpler) that works...

> @lgarron seems your method, while great, will cause the worker to be executed in the context of the page, and hence its `onmessage` handler will receive any message sent...