JeremyRH / storybook-addon-code-editor

A Storybook add-on for live editing stories.
https://jeremyrh.github.io/storybook-addon-code-editor
MIT License
18 stars 7 forks source link

getting error: "Cannot resolve package path for: monaco-editor" in windows #41

Closed jayant4frndz007 closed 2 months ago

jayant4frndz007 commented 3 months ago

I am facing this issue when I am running storybook after adding storybook-addon-code-editor on windows but same is running fine on mac-os.

storybook: 8.0.10 storybook-addon-code-editor : 3.0.0 windows: 8

SB_CORE-SERVER_0007 (MainFileEvaluationError): Storybook couldn't evaluate your .storybook\main.ts file.

Error: Cannot resolve package path for: 'monaco-editor'.
Entry file: \node_modules\monaco-editor\package.json
    at resolvePackagePath (i:\Projects\Sprint-224\conflict-pepper\pepper\node_modules\storybook-addon-code-editor\dist\cjs\getStaticDirs.js:37:15)
    at getExtraStaticDir (i:\Projects\Sprint-224\conflict-pepper\pepper\node_modules\storybook-addon-code-editor\dist\cjs\getStaticDirs.js:59:22)
    at Object.<anonymous> (i:\Projects\Sprint-224\conflict-pepper\pepper\.storybook\main.ts:17:16)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._compile (\node_modules\esbuild-register\dist\node.js:2258:26)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Object.newLoader [as .ts] (\node_modules\esbuild-register\dist\node.js:2262:9)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
JeremyRH commented 3 months ago

Thank you for reporting this. The issue is with getStaticDirs.ts not handling windows path separators.

I'll have a fix for this in a few hours.

JeremyRH commented 3 months ago

I think I have a fix but did not test it on windows. Please let me know if version 3.0.1 does not fix this.

jayant4frndz007 commented 3 months ago

thank you so much. I have upgraded to version 3.0.1 and its working fine.👍