I'm using intl-number-input in a SvelteKit app and I'm getting this error:
(node:71606) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
/Users/andreas/Projects/summerator/node_modules/intl-number-input/dist/index.esm.js:589
export { CurrencyDisplay, NumberFormatStyle, NumberInput, UnitDisplay };
^^^^^^
SyntaxError: Unexpected token 'export'
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:190:29)
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
SvelteKit apps are built with Vite and this is not an uncommon issue. I'm not deep enough into Vite to fully understand what's going wrong. All I could figure out is that it's to do with loading of ESM modules.
The error can be avoided by adding "type": "module" in node_modules/intl-number-format/package.json which isn't really a fix but might point to the source of the problem.
The App is quite minimal and if you care to check it out and help me fix it, I'd very much appreciate it :)
Hi,
I'm using intl-number-input in a SvelteKit app and I'm getting this error:
SvelteKit apps are built with Vite and this is not an uncommon issue. I'm not deep enough into Vite to fully understand what's going wrong. All I could figure out is that it's to do with loading of ESM modules.
The error can be avoided by adding
"type": "module"
innode_modules/intl-number-format/package.json
which isn't really a fix but might point to the source of the problem.The App is quite minimal and if you care to check it out and help me fix it, I'd very much appreciate it :)
https://github.com/juni0r/summerator/tree/intl-number-input
or
Thanks!