Skip to content
Advertisement

Error when import a node_module on svelte

i have to create a module to use on my application, but when I import that in my major project i have this error

JavaScript

I have not the folder dist/index.js, in the guide I followed I did not see that it was necessary to make the package, also in another project i did not have these problems. My version of node is v12.16.2


I update my rollup to build with npm run dev

Here there is my new rollup

JavaScript

But i have again this error

JavaScript

Advertisement

Answer

Your rollup config build your package in dist/bundle.js:

JavaScript

But you probably defined in your package.json:

JavaScript

But dist/index.js doesn’t exits. Just replace it with "main": "dist/bundle.js".

Advertisement