Runtime error when consuming Angular + Vite component library wrapping monaco-languageclient in an Nx workspace #1031
Replies: 4 comments 3 replies
-
|
Hi @vishnuvarthan-balasubramaniam is it possible to share a re-producible example in repository, so we can try it out ourselves? Thank you. For sure with the standard angular build system our stack does not work properly. Our current work-around is to rely on |
Beta Was this translation helpful? Give feedback.
-
|
The error is a hint that the issue is related to https://github.com/CodinGame/monaco-vscode-api/wiki/Troubleshooting#duplicate-versions though |
Beta Was this translation helpful? Give feedback.
-
|
Hi @kaisalmen I have put together a reproducible example here: https://github.com/vishnuvarthan-balasubramaniam/monaco-languageclient-vite-angular I reviewed the troubleshooting wiki you shared. While it provides workarounds for Webpack, I couldn't find a solution applicable to Angular's esbuild setup. I also ran npm list @codingame/monaco-vscode-api and confirmed the duplicate versions issue mentioned in the documentation. I attempted to resolve this by forcing all related dependencies to the same version using overrides in my package.json. However, doing so causes a getUri error at runtime. Additionally, despite explicitly defining the version in overrides, npm occasionally ignores it and installs a lower version anyway. Could you please take a look at the repository to see what might be going wrong? Let me know if you need any additional details or logs. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
|
Hi @kaisalmen Thank you for taking the time to explore the project. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Team,
I'm working on integrating
monaco-languageclientinto an Angular application, but I've run into a persistent issue when trying to consume it as a packaged library.Context & Setup
I am build a reusable component library in Angular that wtaps the Monaco Editor and LSP functionality.
The component library is built with Vite & Rollup options and its been consumed by the Angular build system (esbuild/webpack)
monaco-languageclientv10.7.0,angular20.3.16The Issue
The component library itself builds successfully. However, when I try to consume this compiled component in my main Nx application, I encounter the following error in the browser console while running the application and editor is not rendered:
What I've Tried
I've experimented with multiple approaches to resolve this, including:
monaco-languageclientdependencies.Despite these efforts, I haven't been able to bypass the error. I suspect there might be a deviation in how I'm building the dependencies via Rollup or how I'm consuming the component or an incompatibility when the standard Angular build system tried to parse the Vite-built library.
Codes & Attachments
To help identify where things might be going wrong, I've attached my key configuration files:
lib/monaco-editor/vite.config.mts
lib/monaco-editor/monaco-editor.component.ts
A reference taken from the verify/angular
package.json in the library application
Added dependencies for the
monaco-languageclientHas anyone successfully set a similar architecture, or can you spot where my implementation might be deviating? Any guidance or pointers would be greatly appreciated because I tried to search and identify the similar patterns in repo or any in documents or in the internet, but no luck.
Please let me know if you need any code or architecture which make sense to help see the overview clearly.
Thanks in advance for your time and help! 🙂
Beta Was this translation helpful? Give feedback.
All reactions