'Monaco-Editor fails on oracle jet build/serve when in release mode

I'm trying to implement the Monaco editor within my oracle jet web application. I've tried with the dev and min folders. It works fine when I run serve without the release mode option but when I include --release on build or serve it is throwing the below error

Error: ENOENT: no such file or directory, open '/web/js/libs/vs/editor/edcore.main.js'

I'm not sure why Monaco is needing the file as that file is not included in either the dev or min folders but it is referenced in the "vs/editor/editor.main.js" file and that is where the error is coming from.

Within Oracle Jet for Require JS the info is stored in the path mapping json as follows :

"vs": {
  "cdn": "3rdparty",
  "cwd": "node_modules/monaco-editor/dev/vs",
  "debug": {
    "src": ["**"],
    "path": "libs/vs/",
    "cdnPath": ""
  },
  "release": {
    "src": ["**"],
    "path": "libs/vs",
    "cdnPath": ""
  }
},

Again, everything is perfect when not optimized into a single js file in the browser using the release option



Solution 1:[1]

You should remove the monaco editor library from the optimization. Add to your before_optimize hook:

configObj.componentRequireJs.paths['vs'] = 'empty:';
configObj.requireJs.paths['vs'] = 'empty:';

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user1848754