diff --git a/.changeset/sixty-olives-lie.md b/.changeset/sixty-olives-lie.md new file mode 100644 index 0000000..537a874 --- /dev/null +++ b/.changeset/sixty-olives-lie.md @@ -0,0 +1,5 @@ +--- +"vite-plugin-eslint4b": patch +--- + +fix: to correctly normalize ESLint module paths diff --git a/src/vite-plugin-eslint4b.ts b/src/vite-plugin-eslint4b.ts index 326fce9..1bd9373 100644 --- a/src/vite-plugin-eslint4b.ts +++ b/src/vite-plugin-eslint4b.ts @@ -297,7 +297,12 @@ function transform( injectSources.forEach((s) => { if (path.isAbsolute(s.module)) { - s.module = `./${path.normalize(path.relative(process.cwd(), s.module))}`; + const normalized = path.normalize(path.relative(process.cwd(), s.module)); + s.module = + normalized.startsWith("./") || normalized.startsWith("../") + ? normalized + : // This must be a relative path to match the esbuild import path. + `./${normalized}`; } });