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

Update @lingui/vite-plugin to support Vite 5 #1805

Closed
ptmkenny opened this issue Nov 24, 2023 · 10 comments · Fixed by #1827
Closed

Update @lingui/vite-plugin to support Vite 5 #1805

ptmkenny opened this issue Nov 24, 2023 · 10 comments · Fixed by #1827

Comments

@ptmkenny
Copy link

Describe the bug
Vite 5 was released on November 16, 2023.

@lingui/vite-plugin can't currently be used with Vite 5.

To Reproduce

Try to update to vite 5 npm update:

npm ERR! Found: vite@5.0.2
npm ERR! node_modules/vite
npm ERR!   dev vite@"^5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vite@"3 - 4" from @lingui/vite-plugin@4.5.0
npm ERR! node_modules/@lingui/vite-plugin
npm ERR!   dev @lingui/vite-plugin@"^4" from the root project
npm ERR! 

Expected behavior
Lingui can be used with Vite 5.

@timofei-iatsenko
Copy link
Collaborator

Did you test it ignoring the warning? I'm wondering do i need simply expand the constraint or some other actions needed?

@ptmkenny
Copy link
Author

Unfortunately I can't say; my app is pretty complicated and when I tried with -force, I got a bunch of other errors related to other code and Vite 5.

@ptmkenny
Copy link
Author

Ok, I got my app building, and it seems to be that the constraint just needs to be incremented.

I can switch between languages in m app and everything appears fine.

@evertbouw
Copy link

evertbouw commented Nov 27, 2023

With an upgrade to Vite 5.0 I'm getting errors on dev server startup No loader is configured for ".po" files
prod builds working fine
repo: https://github.com/evertbouw/lingui-issue

@evertbouw
Copy link

evertbouw commented Nov 30, 2023

Esbuild changed something for dynamic imports https://github.com/evanw/esbuild/releases/tag/v0.19.0
So I guess this is the fix now evertbouw/lingui-issue@8aed6a0

This does include all the translations in your main chunk, the note about not bundling doesn't seem to work in this case.

@evertbouw
Copy link

evertbouw commented Nov 30, 2023

I guess this works but I hate it evertbouw/lingui-issue@aa903a1

@timofei-iatsenko
Copy link
Collaborator

yeah it seems this is the way. I also remember that i already did it in one of the examples, but quick check in the repo didn't show that.

@renchap
Copy link
Contributor

renchap commented Dec 13, 2023

An alternative is to use import('.../file.po?lingui'), then it works properly (in my app at least)

akiver added a commit to akiver/cs-demo-manager that referenced this issue Dec 13, 2023
@akiver
Copy link

akiver commented Dec 13, 2023

Hi, I also had this issue with npm 9 which is strict about peer deps:
Screenshot 2023-12-13 at 23 31 02

As a tmp workaround I added a .npmrc file with legacy-peer-deps = true to force npm to ignore peer deps issues.

About the loader error, I used the @renchap fix when importing po files - it works fine.

@andrii-bodnar andrii-bodnar pinned this issue Dec 14, 2023
monholm added a commit to monholm/js-lingui that referenced this issue Jan 3, 2024
The `No loader is configured for ".po" files` was fixed in `vite@5.0.9`.

Resolves lingui#1805
@monholm
Copy link
Contributor

monholm commented Jan 3, 2024

The No loader is configured for ".po" files error was fixed in vite@5.0.9. I've just opened a PR that widens the peer dependency version range, as we haven't experienced any other issues using vite@5 :)

@andrii-bodnar andrii-bodnar unpinned this issue Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants