Giter Club home page Giter Club logo

Comments (3)

remcohaszing avatar remcohaszing commented on August 22, 2024

Having a link to the repository is really helpful! 😄

Does it work if you set globalAPI: false in the MonacoEditorWebpackPlugin options?

Personally I recommend to not use monaco-editor-webpack-plugin at all. It’s just not necessary. Since you’re using Webpack 4 (based on your package-lock.json), I recommend having a look at https://github.com/remcohaszing/monaco-yaml/tree/v3.0.0/examples/webpack-worker-loader.

I think the following section should just make it work:

// NOTE: This will give you all editor featues. If you would prefer to limit to only the editor
// features you want to use, import them each individually. See this example: (https://github.com/microsoft/monaco-editor-samples/blob/master/browser-esm-webpack-small/index.js#L1-L91)
import 'monaco-editor';
import { editor } from 'monaco-editor/esm/vs/editor/editor.api';
import { setDiagnosticsOptions } from 'monaco-yaml';
// NOTE: using loader syntax becuase Yaml worker imports editor.worker directly and that
// import shouldn't go through loader syntax.
import EditorWorker from 'worker-loader!monaco-editor/esm/vs/editor/editor.worker';
import YamlWorker from 'worker-loader!monaco-yaml/lib/esm/yaml.worker';
window.MonacoEnvironment = {
getWorker(workerId, label) {
if (label === 'yaml') {
return new YamlWorker();
}
return new EditorWorker();
},
};

Note that you must use Webpack loader syntax because of microsoft/monaco-editor#2592

And maybe you need this to make icons work. I’m not familiar with Angular build tooling.

{
test: /\.ttf$/,
loader: 'file-loader',
},

from monaco-yaml.

remcohaszing avatar remcohaszing commented on August 22, 2024

I recently found out unikubehq/frontend (see here) also uses monaco-yaml with monaco-webpack-plugin. Does this help?

from monaco-yaml.

remcohaszing avatar remcohaszing commented on August 22, 2024

I’m going to close this issue, because the same issue was resolved in #98

from monaco-yaml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.