Akryum / meteor-vite

MIT License
33 stars 16 forks source link

i18n not working after switching to vite #19

Open juliandierker opened 1 year ago

juliandierker commented 1 year ago

Hey we maintain a big meteor typescript project and we are desperately looking for a faster building solution than meteor standart bundle system. We are trying out vite right now with this package and running into an issue that after installing and configurating our i18n translation in app breaks somehow.

image

We use i18n via universe:i18n and translation lives in root directory in a folder called i18n in yml format.

Thx for any ideas and help.

Akryum commented 1 year ago

Do you mind putting up a reproduction I can clone? Thanks!

juliandierker commented 1 year ago

I'm not allowed to send out invitations to forks :( Project-Structure is: image

i could reproduce a smaller project for sure.

General questions: What is the status of meteor-vite overall? is there any chance this becomes official meteor package?

PatrickKaim commented 1 year ago

I seem to have the same issue. Very easy to reproduce. I've setup a simple project: https://github.com/PatrickKaim/VueI18NTest.git

How to reproduce:

const i18n = createI18n({ legacy: false, locale: userLocale, fallbackLocale: 'en-US', globalInjection: true, missingWarn: false, fallbackWarn: false, messages }) `

Project should work on localhost:3000

PatrickKaim commented 1 year ago

Just to make sure the build is working I created a clean project and just did a build. Build went ok but bundling didn't.

meteor create project --vue And did a run => works And a build (meteor build ../output) => errors

meteor build ../output ⚡️ Building packages to make them available to export analyzer... ⚡️ Packages built (11591.01ms) ⚡️ Building with Vite... vite v3.2.5 building for production... transforming... ✓ 33 modules transformed. rendering chunks... node_modules/.vite-meteor/dist/meteor-entry.js 0.02 KiB / gzip: 0.04 KiB node_modules/.vite-meteor/dist/About.js 0.59 KiB / gzip: 0.33 KiB node_modules/.vite-meteor/dist/main.js 284.71 KiB / gzip: 67.26 KiB

⚡️ Build successful (733.51ms) Errors prevented bundling:
While minifying app code:
packages/minifyStdJS/plugin/minify-js.js:49:25: terser minification error (SyntaxError:"Import" statement may only appear at the top level) Source file: client/main.js (2:0) Line content: import "./vite/meteor-entry.js"

at maybeThrowMinifyErrorBySourceFile (packages/minifyStdJS/plugin/minify-js.js:49:25) at packages/minifyStdJS/plugin/minify-js.js:77:11 at Array.forEach () at MeteorMinifier.processFilesForBundle (packages/minifyStdJS/plugin/minify-js.js:66:11)

While minifying app code: packages/minifyStdJS/plugin/minify-js.js:49:25: terser minification error (SyntaxError:"Import" statement may only appear at the top level) Source file: client/main.js (2:0) Line content: import "./vite/meteor-entry.js"

at maybeThrowMinifyErrorBySourceFile (packages/minifyStdJS/plugin/minify-js.js:49:25) at packages/minifyStdJS/plugin/minify-js.js:77:11 at Array.forEach () at MeteorMinifier.processFilesForBundle (packages/minifyStdJS/plugin/minify-js.js:66:11)