-
Notifications
You must be signed in to change notification settings - Fork 382
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
feat(vite-plugin): add error handling for dynamic import of @lingui/macro #2056
base: main
Are you sure you want to change the base?
feat(vite-plugin): add error handling for dynamic import of @lingui/macro #2056
Conversation
…acro This commit adds error handling for dynamically importing the @lingui/macro module in the vite-plugin. When the @lingui/macro module is dynamically imported, an error is thrown with a helpful message guiding the user to check their import statement and providing a link to the documentation for configuring Vite with Lingui correctly. Closes lingui#2050
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
LGTM, thanks for contribution |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2056 +/- ##
==========================================
- Coverage 76.65% 75.45% -1.20%
==========================================
Files 81 89 +8
Lines 2090 2176 +86
Branches 533 552 +19
==========================================
+ Hits 1602 1642 +40
- Misses 375 423 +48
+ Partials 113 111 -2 ☔ View full report in Codecov by Sentry. |
@maastrich are you going to add something to this PR or you finished? We are preparing v5 release and it would be better to switch it to the |
Hi @maastrich, is there anything we can do to move this PR forward? |
@@ -33,6 +33,16 @@ export function lingui(linguiConfig: LinguiConfigOpts = {}): Plugin[] { | |||
) | |||
} | |||
}, | |||
resolveDynamicImport(specifier, importer, options) { | |||
if (specifier === "@lingui/macro") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in v5 it should check for @lingui/macro
and @lingui/react/macro
and @lingui/core/macro
Description
Make sure the user understands why
@lingui/macro
is not handled by babel/swc when dynamically imported.Types of changes
Checklist