-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
Load monaco files from node_modules doesn't work #482
Comments
@vladtimss try this |
but if i use CRA, a don't understand how can add webpack plugin |
@vladtimss do the following:
cp -R ./node_modules/monaco-editor/min/vs ./public
import { loader } from '@monaco-editor/react';
loader.config({ paths: { vs: '/vs' } }); |
I've made some research on this topic and have shared my findings in an article. Hopefully, it will be useful. |
I gave up on load resouce from node_modules and chose the CDN addressRecently I encountered a similar problem. I searched on Google for ❌ Writing like this will cause the loss of the highlightingimport Editor from "@monaco-editor/react";
import loader from '@monaco-editor/loader';
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
loader.config({ monaco }); ❌ Writing like this will cause some errorsimport Editor from "@monaco-editor/react";
import loader from '@monaco-editor/loader';
import * as monaco from 'monaco-editor';
loader.config({ monaco }); ✅ At last I have found a solution here. If you are a user in mainland China :import Editor from "@monaco-editor/react";
import loader from '@monaco-editor/loader';
loader.config({ paths: { vs: 'https://g.alicdn.com/code/lib/monaco-editor/0.44.0/min/vs' } }); This is the CDN address provided by Alibaba, which has a great speed in mainland China. |
Hi! Thanks for your great job of this project.
I extremely need help to solve problem with load monaco from node modules.
Below you can see my usage of @monaco-editor/react via loader. My problem is not understanding how set correct paths a vs in loader.config({ paths: { vs: HERE } }). Please help to understand what's wrong from my side.
I tried to read carefully this discussion. But,
import { monaco } from '@monaco-editor/react';
than monaco doesn't have method as config, urls etc. We only now can use loader.config.if a set path by node_modules, than get
SyntaxError: Unexpected token '<' (at loader.js:1:1)
Please help!
The text was updated successfully, but these errors were encountered: