compute-scroll-into-view
compute-scroll-into-view copied to clipboard
Vite v3 error saying shipped as CommonJS package
I'm trying to use this package over at https://github.com/janosh/svelte-multiselect with vite v3 and getting the following error:
SyntaxError: Unexpected token 'export' ❯ Object.compileFunction node:vm:360:18
Module
node_modules/compute-scroll-into-view/dist/index.module.js:1seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package "compute-scroll-into-view" asking them to ship the file in.mjsextension or add"type": "module"in theirpackage.json.As a temporary workaround you can try to inline the package by updating your config:
// vitest.config.js export default { test: { deps: { inline: [ "compute-scroll-into-view" ] } } }
Any reservations about adding "type": "module" to package.json?