pablo-abc / svelte-markdown

Markdown parser to svelte components
MIT License
359 stars 50 forks source link

Uncaught Error: Cannot find module || Please verify that the package.json has a valid "main" entry #19

Closed Curstantine closed 3 years ago

Curstantine commented 3 years ago

Uncaught Error: Cannot find module '~~/node_modules/svelte-markdown/dist/sveltemarkdown.js'. Please verify that the package.json has a valid "main" entry gets returned when used like this:

<script>
  import SvelteMarkdown from "svelte-markdown";
  export let value =
</script>
//...
 <article>
    <SvelteMarkdown {value} />
 </article>
// package.json
  "dependencies": {
// ...
    "svelte-markdown": "^0.1.10",
  },

image

quasarchimaere commented 3 years ago

i am currently running into the same issue, did you fix this by adding it to the devDependencies?

Curstantine commented 3 years ago

Tried both, I thought I was doing something wrong so I closed the issue.

quasarchimaere commented 3 years ago

Ok just as a general Info, as described in the readme you have to add svelte-markdown as a devDependency if you use sapper, but only as a devDependency, our issue was that we did not remove the normal dependency and thus fell into the same issue as described above, it works for us now

pablo-abc commented 3 years ago

Should I be more specific about Sapper usage in the README? Since people seem to be jumping to SvelteKit I didn't worry too much aboutt that.

One thing I noticed from your snippet, @Curstantine is that the prop for Svelte Markdown should be called source not value. So <SvelteMarkdown source={value} /> should work.

quasarchimaere commented 3 years ago

@pablo-abc i don't know if being more specific about sapper would help, afaik it seems to work just fine if you are able to read and do things according to your description. maybe you should make a distinction between sveltekit and sapper, since sveltekit is by far not production ready yet