NextLegacy
NextLegacy4w ago

Deno + SvelteKit + Paraglide | Can not run dev server using deno because of "FsWatcher"

Hey there everyone :hooray_deno: I have been trying out Deno for my SvelteKit projects and enjoying it so far. However, I ran into an issue when using Paraglide. While running the development server, I keep encountering this error:
error: Uncaught Error: Input watch path is neither a file nor a directory.
at new FsWatcher (ext:runtime/40_fs_events.js:24:17)
at Object.watchFs (ext:runtime/40_fs_events.js:74:10)
at ext:deno_node/_fs/_fs_watch.ts:57:21
at callback (ext:deno_web/02_timers.js:58:7)
at eventLoopTick (ext:core/01_core.js:210:13)
error: Uncaught Error: Input watch path is neither a file nor a directory.
at new FsWatcher (ext:runtime/40_fs_events.js:24:17)
at Object.watchFs (ext:runtime/40_fs_events.js:74:10)
at ext:deno_node/_fs/_fs_watch.ts:57:21
at callback (ext:deno_web/02_timers.js:58:7)
at eventLoopTick (ext:core/01_core.js:210:13)
I suspect the issue might be with Paraglide or one of its dependencies, but I am not entirely sure how to fix it. After some failed tinkering and not beeing able to find the relevant part in the actual github repo of said library, Ive decided to try my luck here. I am not entirely sure if its a Paraglide or Deno issue, as node is running it just fine, and since it is a recommended package by the official SvelteKit CLI, it would be great if it worked out of the box with Deno. Additional Context: - The development server does not work, but it runs fine when building for production. - I have read once that this error does not occur on non-Windows devices, so it might be a platform-specific issue. (not 100% sure on this, could not find the source again :/) - vite.config.ts looks like this:
import { paraglide } from "@inlang/paraglide-sveltekit/vite"
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [
sveltekit(),
paraglide({ // "deno run dev" works fine without this
project: "./project.inlang",
outdir: "./src/lib/paraglide"
})
]
});
import { paraglide } from "@inlang/paraglide-sveltekit/vite"
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [
sveltekit(),
paraglide({ // "deno run dev" works fine without this
project: "./project.inlang",
outdir: "./src/lib/paraglide"
})
]
});
How to Reproduce: 1. Create a new SvelteKit project using the CLI:
deno run npm:sv create project_name

deno run npm:sv create project_name

2. Select Paraglide during setup. 3. install once and run the development server:
deno install --allow-scripts
deno task dev

deno install --allow-scripts
deno task dev

Thanks in advance for any help or guidance! :deno_thankyou:
1 Reply
NextLegacy
NextLegacyOP4w ago
My fix for now :deno_it_works:: vite.config.ts:
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig, Plugin } from "vite";

const paraglideCustomPlugin: Plugin = {
name: "paraglide-custom-plugin",
configureServer: () => {
(async () => {
const command = new Deno.Command(Deno.execPath(), {
args: [
"run",
"--allow-read", "--allow-env", "--allow-sys", "--allow-net", "--allow-write",
"npm:@inlang/paraglide-js",
"compile",
"--watch",
"--project", "./project.inlang",
"--outdir", "./src/lib/paraglide"
],
stdout: "inherit",
stderr: "inherit"
});

await command.output();
})();
}
};

export default defineConfig({
plugins: [
sveltekit(),
paraglideCustomPlugin
]
});
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig, Plugin } from "vite";

const paraglideCustomPlugin: Plugin = {
name: "paraglide-custom-plugin",
configureServer: () => {
(async () => {
const command = new Deno.Command(Deno.execPath(), {
args: [
"run",
"--allow-read", "--allow-env", "--allow-sys", "--allow-net", "--allow-write",
"npm:@inlang/paraglide-js",
"compile",
"--watch",
"--project", "./project.inlang",
"--outdir", "./src/lib/paraglide"
],
stdout: "inherit",
stderr: "inherit"
});

await command.output();
})();
}
};

export default defineConfig({
plugins: [
sveltekit(),
paraglideCustomPlugin
]
});

Did you find this page helpful?