Closed thenbe closed 3 weeks ago
@loris.sigrist
I can't repro this but perhaps I'm not doing it right. Moving the issue to paraglide
Since https://github.com/opral/monorepo/pull/2681 JSON errors should be propagated
This is working for me with the example repo linked above, when i change en.json to introduce a JSON error
$ p paraglide-js compile --project ./project.inlang/
ℹ [paraglide] Compiling inlang project at "./project.inlang/".
Using existing cloned repo
WARN The project has errors:
ERROR An error occured in loadMessages() caused by SyntaxError: Expected property name or '}' in JSON at position 3.
at node_modules/.pnpm/@inlang+paraglide-js@1.9.1/node_modules/@inlang/paraglide-js/dist/index.js:9234:34
~/opral/paraglide-sveltekit-example$
File not found errors are not considered errors a.t.m and the message file will be auto-created if missing, on first write. There is an issue to improve this. MESDK-99 (https://github.com/opral/inlang-message-sdk/issues/60)
@thenbe could you please provide more specific steps to reproduce this (ideally link to a test repo on github) and your project.inlang/settings.json file.
Here are the repro steps:
git clone https://github.com/LorisSigrist/paraglide-sveltekit-example.git
cd paraglide-sveltekit-example
pnpm install
echo '// i am a comment' >> messages/en.json
pnpm vite dev
And this is the full error message:
WARN No messages found - Skipping compilation into ./src/lib/paraglide
@loris.sigrist i can confirm
$ echo '// i am a comment' >> messages/en.json
pnpm vite dev
Using existing cloned repo
WARN No messages found - Skipping compilation into ./src/lib/paraglide
VITE v5.2.12 ready in 3182 ms
$ pnpm paraglide-js compile --project project.inlang/
ℹ [paraglide] Compiling inlang project at "project.inlang/".
Using existing cloned repo
WARN The project has errors:
ERROR An error occured in loadMessages() caused by SyntaxError: Expected property name or '}' in JSON at position 3.
at node_modules/.pnpm/@inlang+paraglide-js@1.9.1/node_modules/@inlang/paraglide-js/dist/index.js:9234:34
$
Current
These two scenarios result in the same error being logged ("missing messages") when running
npx vite dev
.pathPattern
:en.json
file:Expected
The second scenario should provide a better error message to indicate the error is the result of invalid json.
Repro
My setup was similar to this example