jphillipsCrestron / ch5-react-ts-template

Minimal demonstration of turning a Vite project with React + TypeScript acting as a single page application into a Crestron HTML5 project, along with PWA support
10 stars 3 forks source link

Failed to resolve entry for package "@crestron/ch5-crcomlib" #1

Closed wficon-avcode closed 7 months ago

wficon-avcode commented 10 months ago

Hello,

I am unable to build the project. I am receiving the following error.

vite v4.5.0 building for production... ✓ 16 modules transformed. ✓ built in 545ms [commonjs--resolver] Failed to resolve entry for package "@crestron/ch5-crcomlib". The package may have incorrect main/module/exports specified in its package.json. error during build: Error: Failed to resolve entry for package "@crestron/ch5-crcomlib". The package may have incorrect main/module/exports specified in its package.json. at packageEntryFailure (file:///C:/Users/admin/Desktop/AV_Code_UI/av-dot-code-ui/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28725:11) at resolvePackageEntry (file:///C:/Users/admin/Desktop/AV_Code_UI/av-dot-code-ui/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28722:5) at tryNodeResolve (file:///C:/Users/admin/Desktop/AV_Code_UI/av-dot-code-ui/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28453:20) at Object.resolveId (file:///C:/Users/admin/Desktop/AV_Code_UI/av-dot-code-ui/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28212:28) at file:///C:/Users/admin/Desktop/AV_Code_UI/av-dot-code-ui/node_modules/rollup/dist/es/shared/node-entry.js:25544:40 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async PluginDriver.hookFirstAndGetPlugin (file:///C:/Users/admin/Desktop/AV_Code_UI/av-dot-code-ui/node_modules/rollup/dist/es/shared/node-entry.js:25444:28) at async resolveId (file:///C:/Users/admin/Desktop/AV_Code_UI/av-dot-code-ui/node_modules/rollup/dist/es/shared/node-entry.js:24117:26) at async ModuleLoader.resolveId (file:///C:/Users/admin/Desktop/AV_Code_UI/av-dot-code-ui/node_modules/rollup/dist/es/shared/node-entry.js:24531:15) at async Object.resolveId (file:///C:/Users/admin/Desktop/AV_Code_UI/av-dot-code-ui/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:7910:10)

Do you have any idea how to solve this problem? Thank you in advance for your help!

jphillipsCrestron commented 10 months ago

Hello @wficon-avcode,

My mistake - I forgot to commit the patch that fixes the Crestron library entry point, which causes npm to fail to install it. I've pushed b82f7dfd9ca53ebc63af0fc11afe878368face86 to fix this. If you clone this repo and run the install again it should work now (just tested it myself on another machine to be sure).

wficon-avcode commented 10 months ago

Great, thank you very much! The project compiles and I can upload it to the panel.

At the moment, the only problem I see is the lack of feedback from the processor (as if the subscribeState functions were not working properly).

After changing ch5-crcomlib to version 2.5.0 and directly importing the subscribeState function in the App component, everything started working properly on the TS-770 panel.

Could this be some kind of a bug of version 2.6.1? Additionally, when using it (2.6.1 version), I tried to call getState functions before the subscribeState ones, but it didn't change anything.

Thank you very much in advance for your help! I appreciate it incredibly!

jphillipsCrestron commented 10 months ago

@wficon-avcode That reported problem doesn't present itself on XX60 panels or WebXPanel in my tests. I was able to replicate the problem on a XX70 panel though, and it seems CORS related when looking at the dev tools. Likely because the project is being "served" via the file system (file://) and browsers inherently block all cross-origin requests on that, so that would explain CrComLib not operating. I'm not sure what the difference is in the structure of 2.5.0 vs 2.6.1, but if 2.5.0 works then that's good to know.

jphillipsCrestron commented 9 months ago

@wficon-avcode This should be resolved now (in this repo specifically) - there were changes to the exported types in CH5 2.6+, which had to be reflected here.