cibernox / svelte-intl-precompile

I18n library for Svelte.js that analyzes your keys at build time for max performance and minimal footprint
https://svelte-intl-precompile.com
ISC License
274 stars 13 forks source link

Watch not working on sveltekit using Linux #37

Closed cristovao-trevisan closed 2 years ago

cristovao-trevisan commented 2 years ago

Hi,

file watch is not working for me, using sveltekit@1.0.0-next.235 (latest) on Linux (Arch). Can be fixed with a single line:

--- sveltekit-plugin.js.2       2022-01-20 18:04:51.301886620 -0300
+++ sveltekit-plugin.js 2022-01-20 18:04:53.861868570 -0300
@@ -147,6 +147,7 @@
                        const { ws, watcher, moduleGraph } = server;
                        // listen to vite files watcher
                        watcher.on('change', (file) => {
+                               file = path.relative('', file);
                                // check if file changed is a locale
                                if (pathStartsWith(file, localesRoot)) {
                                        // invalidate $locales/<locales><extname> modules

The "file" argument is being received as an absolute path, the change above fixes it by making it relative.

Should work even if file is already relative, eg.: image

dlebech commented 2 years ago

I have the same problem on Ubuntu 20.04. Adding the above line works in my case as well.

bummzack commented 2 years ago

Same problem occurs on Mac OS X, also resolved by above fix. Maybe some SvelteKit internals changed?

cibernox commented 2 years ago

I'll fix this today

cibernox commented 2 years ago

I published 0.8.1 today that should fix this issue. Let me know if it's not fixed. Closing it for now.