Closed
Description
Describe the bug
Someone on Discord reported that they can't get bytemd
to work. It looks to me like vite-plugin-svelte
is not detecting that bytemd
's lodash.debounce
dependency needs to be prebundled. There are also issues reported in the bytemd
repo and on Discord where the error occurs on other dependencies
A couple things I noticed that are off about the packaging:
bytemd
uses.esm.js
and.cjs.js
extensions instead of.mjs
and.cjs
lodash.debounce
has nomain
or any other entry point specified in thepackage.json
Even when I manually edit those I still get the same error.
Reproduction
https://github.com/benmccann/sveltekit-bytemd-bug-reproduction
Logs
8:07:24 PM [vite] Error when evaluating SSR module /node_modules/lodash.debounce/index.js?v=dc88d06f:
ReferenceError: module is not defined
at /node_modules/lodash.debounce/index.js?v=dc88d06f:377:1
System Info
reproduction provided
Severity
The top two bugs in the bytemd
repo are about how the project doesn't work with SvelteKit: https://github.com/bytedance/bytemd/issues/96 and https://github.com/bytedance/bytemd/issues/139