In my SvelteKit (using vite) project with adapter-static configured, I cannot build static files, because I get an error when importing i18next-browser-language-detector.
(node:4019) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/project/node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetector.js:1
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1055:15)
at Module._compile (node:internal/modules/cjs/loader:1090:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29)
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
[vite-plugin-svelte-kit] Prerendering failed with code 1
error during build:
Error: Prerendering failed with code 1
at ChildProcess.<anonymous> (file:///project/node_modules/@sveltejs/kit/src/exports/vite/index.js:442:15)
at ChildProcess.emit (node:events:513:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
To Reproduce
create sveltekit project with npm create svelte (with typescript enabled)
🐛 Bug Report
In my SvelteKit (using vite) project with adapter-static configured, I cannot build static files, because I get an error when importing i18next-browser-language-detector.
To Reproduce
npm create svelte
(with typescript enabled)svelte.config.*
import LanguageDetector from 'i18next-browser-language-detector'
npm run build
to build static filesExpected behavior
No errors and success when running
npm run build
Your Environment