svelte-lexical icon indicating copy to clipboard operation
svelte-lexical copied to clipboard

How to run demo sveltekit svelte-lexical ?

Open ProtonBeamCannon opened this issue 1 year ago • 13 comments

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

ProtonBeamCannon avatar Aug 17 '24 22:08 ProtonBeamCannon

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.

umaranis avatar Aug 18 '24 20:08 umaranis

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 ?

ProtonBeamCannon avatar Aug 18 '24 22:08 ProtonBeamCannon

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 avatar Aug 19 '24 09:08 umaranis

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

Could you confirm if it resolves the issue?

umaranis avatar Aug 19 '24 13:08 umaranis

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

ProtonBeamCannon avatar Aug 19 '24 18:08 ProtonBeamCannon

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 avatar Aug 21 '24 21:08 umaranis

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.

umaranis avatar Aug 21 '24 22:08 umaranis

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

ProtonBeamCannon avatar Sep 04 '24 17:09 ProtonBeamCannon

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

umaranis avatar Sep 05 '24 09:09 umaranis

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/[email protected]_@[email protected]/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/[email protected]_@[email protected]/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/[email protected]_@[email protected]/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/[email protected]_@[email protected]/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/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:65948:15) at file:///C:/Users/user/Desktop/Prog/Lexical/svelte-lexical/node_modules/.pnpm/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:12701:10)  ELIFECYCLE  Command failed with exit code 1.

ProtonBeamCannon avatar Sep 06 '24 20:09 ProtonBeamCannon

Hi @ProtonBeamCannon ,

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

umaranis avatar Sep 07 '24 14:09 umaranis

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?

ProtonBeamCannon avatar Sep 15 '24 17:09 ProtonBeamCannon

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.

umaranis avatar Sep 25 '24 14:09 umaranis

@ProtonBeamCannon hit the same issue - fixed by editing packages/svelte-lexical/package.json, change:

"build": "vite build && pnpm package",

to

"build": "vite build && npm run package",

package.json assumes that pnpm` is installed, so another option would be to install it.

MattBrittan avatar Dec 16 '24 20:12 MattBrittan