hashmd: Cant get this working in Svelte Kit
Hi I can’t seem to get this working in Svelte Kit.
Like all my other modules:
[vite] Error when evaluating SSR module /node_modules/remark-parse/index.js?v=94403ef9:
ReferenceError: module is not defined
at /node_modules/remark-parse/index.js?v=94403ef9:3:1
at instantiateModule (/Users/marcgodard/Documents/Github/swp-crm/node_modules/vite/dist/node/chunks/dep-0ed4fbc0.js:69982:166)
And If I turn SSR off I get:
[vite] Internal server error: Cannot find module './transformers/module'
Has anyone gotten this working yet?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 10
- Comments: 34 (7 by maintainers)
After upgrading to
bytemd@^1.12.4
Sveltekit is working w/o needing to use VanillaJS config oroptimizeDeps
. Thanks.Yep I have the same problem 😭
Also added a Sveltekit example here: https://github.com/bytedance/bytemd/tree/main/examples/svelte
Yep, same here
Hi all, thanks for providing so much context for this issue!
I have provided an example here, which is built with the latest version of SvelteKit (with tag
next
). Hope this can helpHi @MarcGodard, sorry for make pollution to your thread. I think you have 2 issue here. First
This caused by ESM problem like we discuss above. Remark parse is cjs module. It cannot work on vite (svelte-kit). So to make this package work we must change how the way cjs module imported or use the esm module version of the module (if exists). Not only remark-parse, the following module is also cjs module: lodash.debounce, lodash.throttle, remark-rehype, etc. So we just wait for maintainer update their dependency from cjs to esm version or change how the module imported For now, I try to copy this bytemd from node_modules to src/vendor and change the code and update the dependency manually.
Second
May be this is different Issue. I cannot reproduce this in my project even I turn off ssr mode.
Ok, thanks for the advice @benwoodward 😊
Would also love to see this issue resolved, just upgraded my project to SvelteKit and now it seems like my editor doesn’t work.