Closed
Description
Using this library with SvelteKit 1.0.0-next.115 on Windows gives the following error:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\quick-i18n-throwaway-demo-main\node_modules\svelte-intl-precompile\index.js
require() of ES modules is not supported.
require() of C:\quick-i18n-throwaway-demo-main\node_modules\svelte-intl-precompile\index.js from C:\quick-i18n-throwaway-demo-main\node_modules\vite\dist\node\chunks\dep-bc228bbb.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\quick-i18n-throwaway-demo-main\node_modules\svelte-intl-precompile\package.json.
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1080:13)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at nodeRequire (C:\quick-i18n-throwaway-demo-main\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:68707:17)
at ssrImport (C:\quick-i18n-throwaway-demo-main\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:68660:20)
at eval (C:\quick-i18n-throwaway-demo-main\src\routes\index.svelte:7:31)
at instantiateModule (C:\quick-i18n-throwaway-demo-main\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:68693:166)
You can see the error on a Windows machine and using your repo: https://github.com/cibernox/quick-i18n-throwaway-demo - but oddly the error isn't thrown on a remote Gitpod environment which is Linux I'm assuming - and you must be devving on a Mac is why you never came across this error? I'm so confused why Windows would spin this up as it seems yet another classic ESM-Vite challenging bug.
Metadata
Metadata
Assignees
Labels
No labels