embroider-build / embroider

Compiling Ember apps into spec-compliant, modern Javascript.
MIT License
333 stars 136 forks source link

Rename #embroider_compat/* to @embroider/virtual/* #2026

Closed BlueCutOfficial closed 2 weeks ago

BlueCutOfficial commented 1 month ago

Rename #embroider_compat/(component|helper|modifier|ambiguous)/<path> for invokable to @embroider/virtual/(component|helper|modifier|ambiguous)/<path> to stop confusing esbuild.

patricklx commented 1 month ago

is this because otherwise it wont pass the bare import filter in vite internal dep scan hook?

BlueCutOfficial commented 1 month ago

Yes 👍

patricklx commented 1 month ago

Okay, just note that there are multiple ways to refer to the same file

For each esbuild would generate a separate bundle id. I'm not entirely sure if it also generates different chunks or just generates another file which imports the same chunks. But it would be less efficient anyway.

So. I'm not sure how much this would help in the end. Short term to get more scan through esbuild. It looks nicer at least :)

Furthermore, when adding new import during dev, vite additionally checks if the import is resolvable with default node resolve and only then makes a new dep scan on it.

We would need to alias all of those to one same import specifier and make it node resolve able.

ef4 commented 1 month ago

This is not going to be necessary. The work in https://github.com/embroider-build/embroider/pull/2029 demonstrates that we can do full resolution in our esbuild plugin before vite's depscan sees anything.