-
-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the example to demonstrate usage of react-monaco-editor #4
Comments
Yes, it is probably a reason. Have you tried to use |
Yes, tried to import it like that:
Afterwards, I even tried to modify bootstrap of app: Before
After
Now it fails with new error:
This seems like an issue with loading monaco editor itself. Part of webpack which defines alias for vs:
|
Updated editor to "monaco-editor": "0.9.0". Seems that it is incompatible:
|
@sshumakov |
thx for reporting the issue with the latest monaco |
Yes, I have noParse section:
It seems that it fails on define('vs/base/browser/iframe'):
|
Is it possible to change monaco-languageclient to not rely on global monaco variable defined and use passed variable instead? With usage of react-monaco-editor, I can render editor and get reference to it without any issues. |
Do you have
I will see how it can be done without breaking other clients. Unfortunately, right now I am busy. |
Yes, otherwise webpack shows the following error:
So I had to add it. I uploaded webpack files: |
PRs are welcomed. The react page should be added to the existing example. |
Would it be possible to fork Another option is to create a new issue in the https://github.com/Microsoft/vscode-languageserver-node repository and ask if they would be interested to ship a Webpack friendly module as well together with the umd bundle. Not sure why they are using umd in the first place instead of commonjs. |
The way I've got it working is to add noParse and pass through the Babel loader:
|
The downside is that this is not an option for Angular-CLI, Vue-CLI, create-react-app users as the |
@SamVerschueren Have you been able to use monaco-languageclient in an Angular CLI project? Is there a way that I could see an example source code? |
Yes, I wrapped it in a module https://github.com/SamVerschueren/ngx-monaco |
Ah, you mean the languageclient... No I did not, without manually overriding the languageserver-types with a CJS friendly version. |
I am willing to override it for now until there is a better solution. Is there a way that I could get your CJS friendly version? Thanks for your help by the way. |
I could put it in a gist if you want. I basically checked out that repository and manually compiled it to CJS instead of UMD. |
in response to #4 (comment): |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I'm facing below errors -
|
Hello, I am following your tutorial to setup monaco editor + language client/server in react based app.
I use react monaco editor package + typescript + webpack and it works great.
When import language client, it fails due to multiple reasons during import.
import {
BaseLanguageClient, CloseAction, ErrorAction,
createMonacoServices, createConnection
} from 'monaco-languageclient';
services.js -
__export(require("vscode-languageserver-types"));
diagnostic-collection.js -
var Uri = monaco.Uri;
In your example, I see that you used webpack and marked main.js loader as entry:
entry: path.resolve(buildRoot, "main.js"),
main.js:
Can it be that main.js and way you initialize monaco editor is the reason why it works? Is it possible to pass monaco editor as dependency to language client instead of using globally defined "monaco" variable?
The text was updated successfully, but these errors were encountered: