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

fix issue with paired component between app and addon #2110

Merged
merged 5 commits into from
Sep 24, 2024

Conversation

patricklx
Copy link
Contributor

@patricklx patricklx commented Sep 16, 2024

error: ERROR: [plugin: embroider-esbuild-resolver] cannot identify what phase vite is in. Saw plugins: embroider-esbuild-resolver
not sure why this setup triggers this. But there is a vite esbuild mode where vite does not add any plugins here:
https://github.com/vitejs/vite/blob/ba56cf43b5480f8519349f7d7fe60718e9af5f1a/packages/vite/src/node/optimizer/index.ts#L1065

@patricklx patricklx force-pushed the fix-app-deps branch 3 times, most recently from dba3110 to 572989e Compare September 16, 2024 07:50
@patricklx patricklx force-pushed the fix-app-deps branch 2 times, most recently from a8e1235 to 8a3bbe7 Compare September 16, 2024 08:06
@patricklx patricklx changed the title issue with paired component between app and addon fix issue with paired component between app and addon Sep 16, 2024
@ef4
Copy link
Contributor

ef4 commented Sep 17, 2024

Thanks, I'm going to run your updated tests without the fix to try to understand this case better.

@patricklx
Copy link
Contributor Author

@ef4 i'm hitting this in another project where im testing vite as well. its because it has .hbs as an entry point and vite wants to scan it for imports

@patricklx
Copy link
Contributor Author

i removed the length check so it also allows for other user plugins

@ef4
Copy link
Contributor

ef4 commented Sep 23, 2024

Using the tests here I see what vite is doing. It's trying to use esbuild to parse a dep's entrypoint when the dep isn't JS, so it needs to load all your custom config, so our resolver gets pulled in.

I think we can avoid this whole situation by moving a little bit of work into stage1 instead. V2 addons are already not allowed to use non-JS files, the only reason vite is encountering some is that we were intentionally lax with auto-upgraded v1 addons.

@patricklx
Copy link
Contributor Author

It might fix this specific case. But the user could add his own esbuild plugins for his own custom dependency. And the check would then throw the error

@patricklx
Copy link
Contributor Author

But that would probably also fix #2119 ?

@ef4 ef4 merged commit f33728f into embroider-build:main Sep 24, 2024
152 checks passed
@ef4 ef4 added the bug Something isn't working label Sep 24, 2024
@github-actions github-actions bot mentioned this pull request Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants