Giter VIP home page Giter VIP logo

Comments (7)

akihikodaki avatar akihikodaki commented on August 24, 2024 3

Confirmed the problem. It incorrectly refers to window.__webpack_public_path__.

from monaco-editor-webpack-plugin.

dmitriylyner avatar dmitriylyner commented on August 24, 2024 2

@rgbkrk This was recently fixed here: #14. Newest release of this plugin v1.3.0 should have this.

from monaco-editor-webpack-plugin.

rgbkrk avatar rgbkrk commented on August 24, 2024 2

I'm currently running into an issue with this here: nteract/nteract#2992

screen shot 2018-06-14 at 2 22 36 pm

$ npm ls monaco-editor-webpack-plugin
[email protected] /Users/kylek/code/src/github.com/nteract/nteract-ext
└── [email protected]

from monaco-editor-webpack-plugin.

rgbkrk avatar rgbkrk commented on August 24, 2024 2

We dynamically set the __webpack_public_path__ well before monaco is loaded (it loads in a chunk, dynamically imported, much later).

from monaco-editor-webpack-plugin.

rgbkrk avatar rgbkrk commented on August 24, 2024 1

🙏 Thank you!

from monaco-editor-webpack-plugin.

z1haze avatar z1haze commented on August 24, 2024 1

We dynamically set the __webpack_public_path__ well before monaco is loaded (it loads in a chunk, dynamically imported, much later).

Could you provide an example of how you're going about setting the __webpack_public_path__ before monaco-editor-webpack-plugin initializes? I don't see how that is feasible as at least in my situation the webpack public path variable is set at runtime.

I end up with files in the correct location but instead of webpack looking for files in the correct public path, it looks for them a domain.com/js/worker.js when in reality it is domain.com/multi-site-name/default/some-version-hash/js/worker.js. We need this plugin to respect the runtime setting of __webpack_public_path__

from monaco-editor-webpack-plugin.

 avatar commented on August 24, 2024

We wanted to provide an app which is loadable from any path, so therefore we dynamically determine the base path on runtime and use it as __webpack_public_path__. The determination happens in the index.html and afterwards based on the determined base path the bundle.js is loaded.

So therefore we also had the problem loading the editor.worker.js file.
We managed to overcome this problem by overriding the getWorkerUrl in the MonacoEnvironment object like this:

window.MonacoEnvironment = {
  getWorkerUrl(moduleId, label) {
    return `${BASE_PATH}${label == 'javascript' ? 'typescript' : 'editor'}.worker.js`;
  }
};

If you want to provide more languages then you have to consider more workers (see issue).
As long as this issue and the subsequent PR is open, this can be considered as a temporary solution.

I hope this helps some people.

from monaco-editor-webpack-plugin.

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.