Sortable icon indicating copy to clipboard operation
Sortable copied to clipboard

[bug] Error when trying to import as an ES Module During SvelteKit build with Vite 3

Open mabentley85 opened this issue 3 years ago • 0 comments

When building a SvelteKit project using Vite 3 I get the following error:

Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
{__MY_PROJECT__}/node_modules/sortablejs/modular/sortable.core.esm.js:3782

I have tried adding "type": "module" to the package.json which resolves this error and things work properly.

Is this something that should be added? Or should I change how I'm importing this package? Currently I'm using this:

import { Sortable } from 'sortablejs/modular/sortable.core.esm.js';

mabentley85 avatar Jul 29 '22 17:07 mabentley85