Closed UlrichRaab closed 6 months ago
It's possible that you have a paraglide-js build
CLI call in your package.json
build script. Try removing it and re-running. Does the issue persist?
I used this guide and your example app to setup Paraglide. I have never added a build call to my package.json
but there is paraglide-js compile --project ./project.inlang
in scripts.build
and postinstall
.
Is this automatically generated when installing ParaglideJS or the SvelteKit Adapter?
{
"name": "xxx",
"version": "0.0.2",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "paraglide-js compile --project ./project.inlang && vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"test:integration": "playwright test",
"test:unit": "vitest",
"postinstall": "paraglide-js compile --project ./project.inlang"
},
...
}
I removed the call from scripts.build
and it works as expected. Do i also have to remove postinstall
?
Thank you for your support.
The call is automatically added by paraglide-js init
. It does this because it can't be assumed that people are using a build tool like vite, so it adds calls to the compiler CLI.
You can safely remove the call from the build
script.
The postinstall
script may be important if you are linting/typechecking in CI without building first, since the paraglide files would be missing. Add --outdir ./src/gen/paraglide
to the command.
The newest version of the init CLI will always add the outdir
flag to the commands to hopefully make it a little more transparent.
We should document this better
I have defined a custom outdir in
vite.config.ts
but the compiled translations are not in the defined dir when i runnpm run build
. When i usenpm run dev
everything works as expected.Here is my
vite.config.ts
: