Closed tillbaks closed 2 years ago
Is this still an issue? I've just successfully run this library on an app on windows, so perhaps it's not longer a problem. If there is, please provide a sample repo I can clone for reproduction.
Yep, still a problem.
I made a small repo here: https://github.com/tillbaks/svelte-intl-precompile-vite-windows-issue
npm install
npm run build
and check output in dist/assets/en....js
var a={"some.id":"Param x is {x} and param y is {y}!","some.other.id":"Without any params.."};export{a as default};
when expected output is:
import{_ as a}from"./vendor.c12a8071.js";var s={"some.id":(r,e)=>`Param x is ${a(r)} and param y is ${a(e)}!`,"some.other.id":"Without any params.."};export{s as default};
@tillbaks I made https://github.com/tillbaks/svelte-intl-precompile-vite-windows-issue/pull/1 to your issue repo with a fix. I hope it helps
@tillbaks Did the changes in 0.8.0 fix your windows issue?
@cibernox not sure. looks like sveltekit-plugin.cjs is missing in 0.8.0
got it working without cjs and v0.8.0: https://github.com/tillbaks/svelte-intl-precompile-vite-windows-issue/commit/aaf32f9b1bb93c92bb3022fe6a3a287f4c636f17
Because paths are separated by backslashes on windows. in
transform(code, id)
the id contains the path with forwardslashes (instead of backslashes) which meansid.includes(resolvedPath)
will never match anything on windows unless I doconst resolvedPath = path.resolve(localesRoot).replace(/\\/g,"/")
. Not sure what would be the best way to solve this. Seems strange that there are forwardslashes at all in the path.Not sure if relevant but I'm not using sveltekit but vite with vite-plugin-svelte node v14.17.6