umaranis / svelte-lexical

Rich text editor for Svelte based on lexical
https://svelte-lexical.vercel.app
MIT License
373 stars 34 forks source link

How to run demo sveltekit svelte-lexical ? #91

Open ProtonBeamCannon opened 3 months ago

ProtonBeamCannon commented 3 months ago

Hi @umaranis I want to try out svelte-lexical and try to run the demo, for sveltekit but I keep getting this error image

Error: Failed to resolve entry for package "svelte-lexical". The package may have incorrect main/module/exports specified in its package.json.

What should I do here ? I made sure I ran npm i svelte-lexical, so what am i missing

umaranis commented 3 months ago

Hi @ProtonBeamCannon , Have you build the ‘svelte-lexical’ package before running the demo project?

Please have a look at ‘getting started’ section in the ReadMe file. Do let me know if you still face any issues? Thanks.

ProtonBeamCannon commented 3 months ago

I tried it again, i followed the readme.md and i run the demo playground and demo sveltekit and still got the same error. the only difference i did was using npm instead pnpm, buts thats irrelevant right ?

umaranis commented 3 months ago

Hi @ProtonBeamCannon , I have just tried on a fresh clone. The build process is broken with npm but works fine with ‘pnpm`. It has also happened a few times in the past due to the ESM and CommonJS mess.

I will look into the recent package upgrades to find the culprit.

umaranis commented 3 months ago

Hi @ProtonBeamCannon , I have pushed a fix on npm-build branch.

Could you confirm if it resolves the issue?

ProtonBeamCannon commented 3 months ago

Did it resolve for you ? I created a fresh clone, pick hte npm-build branch, go to the cd packages/svelte-lexical, npm i, npm run build, I tried to go to the demos playground and sveltekit and npm run dev. but still get the same error, after that i tried run npm install and its the same, I tried to npm run build on demos/sveltekit and i got this image

Maybe this is a clue? My node v20.6.1 if this matters, also this is the package.json image

umaranis commented 3 months ago

Hi @ProtonBeamCannon , yes, 'npm-build` branch resolves the issue for me.

My node version is 22.5.1.

Are you able to upgrade to this version and test?

umaranis commented 3 months ago

Here is my output for the same command image

I would appreciate it if you could upgrade your node to 22.5.1 and give it a go.

ProtonBeamCannon commented 2 months ago

Hi, sorry responding so late, i upgrade the node to v22.5.1 image

I tried both npm and pnpm in the folder svelte-lexical and svelte-lexical/demo/sveltekit , it didnt work

image

umaranis commented 2 months ago

This is strange.

Could you share the full output of all the commands you are running? For instance, pnpm i, pnnpm build and pnpm dev from the packages/svelte-lexical directory. @ProtonBeamCannon

ProtonBeamCannon commented 2 months ago

image

image

error during build: [commonjs--resolver] Failed to resolve entry for package "svelte-lexical". The package may have incorrect main/module/exports specified in its package.json. at packageEntryFailure (file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/vite@5.3.3_@types+node@20.12.8/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:47164:15) at resolvePackageEntry (file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/vite@5.3.3_@types+node@20.12.8/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:47161:3) at tryNodeResolve (file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/vite@5.3.3_@types+node@20.12.8/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:46977:16) at Object.resolveId (file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/vite@5.3.3_@types+node@20.12.8/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:46727:19) at Object.handler (file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/vite@5.3.3_@types+node@20.12.8/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:65948:15) at file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/rollup@4.17.2/node_modules/rollup/dist/es/shared/node-entry.js:19778:40 at async PluginDriver.hookFirstAndGetPlugin (file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/rollup@4.17.2/node_modules/rollup/dist/es/shared/node-entry.js:19678:28) at async resolveId (file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/rollup@4.17.2/node_modules/rollup/dist/es/shared/node-entry.js:18359:26) at async ModuleLoader.resolveId (file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/rollup@4.17.2/node_modules/rollup/dist/es/shared/node-entry.js:18762:15) at async Object.resolveId (file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/vite@5.3.3_@types+node@20.12.8/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:12701:10)  ELIFECYCLE  Command failed with exit code 1.

umaranis commented 2 months ago

Hi @ProtonBeamCannon ,

As I requested, could you please run these commands from the packages/svelte-lexical folder (not demos/sveltekit)?

ProtonBeamCannon commented 2 months ago

Hi sorry for the late reply, yes what i meant was i tried everything but of course i tried to follow your instruction that i go to packages/svelte-lexical and then npm install then npm run build after that i got this error image

after that i went to demos/playground and stated in your readme.md and try npm run dev but the i got the error.

Can you show me an example of it working in Stackblitz so that we can debug this in the same environment together?

umaranis commented 2 months ago

Hi @ProtonBeamCannon ,

Here is the StackBlitz for demos/playground:

https://stackblitz.com/~/github.com/umaranis/svelte-lexical/tree/stackblitz-playground?view=editor

Have a look at .stackblitzrc file for the start command (the branch is stackblitz-playground).

StackBlitz for packages/svelte-lexical

https://stackblitz.com/~/github.com/umaranis/svelte-lexical?configPath=packages/svelte-lexical

This is not a separate demo project, but an example included in the library project.

Stackblitz demo using npm

https://stackblitz.com/~/github.com/umaranis/svelte-lexical-playground-stackblitz?view=editor

This a separate project (outside of the monorepo using npm instead of pnpm.