Skip to content
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

Webpack build error with 0.18 #1572

Closed
domoritz opened this issue Sep 5, 2019 · 6 comments
Closed

Webpack build error with 0.18 #1572

domoritz opened this issue Sep 5, 2019 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority
Milestone

Comments

@domoritz
Copy link
Contributor

domoritz commented Sep 5, 2019

monaco-editor version: 0.18.0

Steps or JS usage snippet reproducing the issue:

I am trying to build the latest monaco with webpack but I am getting the following error:

./node_modules/monaco-editor/esm/vs/base/worker/defaultWorkerFactory.js 35:32-39
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

You can reproduce this error by cloning https://github.com/vega/editor/tree/dom/upgrade and running

yarn && yarn start
@prodigy99
Copy link

same problem

@ErkoKnoll
Copy link

Not sure if it is related but in addition to that warning I'm also getting the following error:

Uncaught ReferenceError: __insane_exports is not defined
    at Object.push../node_modules/monaco-editor/esm/vs/base/common/insane/insane.js.4../defaults (:3000/static/js/0.chunk.js:78167)
    at o (:3000/static/js/0.chunk.js:78086)
    at r (:3000/static/js/0.chunk.js:78095)
    at Object../node_modules/monaco-editor/esm/vs/base/common/insane/insane.js (:3000/static/js/0.chunk.js:78101)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Module../node_modules/monaco-editor/esm/vs/base/browser/markdownRenderer.js (:3000/static/js/0.chunk.js:53998)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Module../node_modules/monaco-editor/esm/vs/editor/contrib/markdown/markdownRenderer.js (:3000/static/js/0.chunk.js:187682)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Module../node_modules/monaco-editor/esm/vs/editor/contrib/hover/modesContentHover.js (:3000/static/js/0.chunk.js:183158)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Module../node_modules/monaco-editor/esm/vs/editor/contrib/hover/hover.js (:3000/static/js/0.chunk.js:182126)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Object../include-loader!./node_modules/monaco-editor/esm/vs/editor/editor.api.js (:3000/static/js/0.chunk.js:67)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Object../node_modules/react-monaco-editor/lib/editor.js (:3000/static/js/0.chunk.js:260909)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Object../node_modules/react-monaco-editor/lib/index.js (:3000/static/js/0.chunk.js:261284)
    at __webpack_require__ (:3000/static/js/bundle.js:787)

@ianberdin
Copy link

After updating from 0.17.1 to 0.18.0 appeared a new bug:
Compiled with 1 warnings warning in ./node_modules/monaco-editor/esm/vs/base/worker/defaultWorkerFactory.js Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

monaco: 0.18.0
webpack: 4.35.3.
worker-loader: 2.0.0

With 0.17.1 works fine.

Workers loaded like this:

import CssWorker from 'worker-loader!../node_modules/monaco-editor/esm/vs/language/css/css.worker.js'
import HtmlWorker  from 'worker-loader!../node_modules/monaco-editor/esm/vs/language/html/html.worker.js'
import TsWorker  from 'worker-loader!../node_modules/monaco-editor/esm/vs/language/typescript/ts.worker.js'
import EditorWorker from 'worker-loader!../node_modules/monaco-editor/esm/vs/editor/editor.worker.js'

const extensionMap = {
  'css': 'css',
  'scss': 'css',
  'sass': 'css',
  'less': 'css',
  'html': 'html',
  'pug': 'html',
  'inky': 'html',
  'typescript': 'js',
  'javascript': 'js',
}

const workers = {
  css: CssWorker,
  html: HtmlWorker,
  js: TsWorker,
  editor: EditorWorker,
}

self.MonacoEnvironment = {
  getWorker: function ( moduleId, label ) {
    const workerType = extensionMap.hasOwnProperty(label) ? extensionMap[label] : 'editor'
    return new workers[workerType]()
  },
}

hanakla pushed a commit to delirvfx/Delir that referenced this issue Sep 12, 2019
hanakla pushed a commit to delirvfx/Delir that referenced this issue Sep 12, 2019
@domoritz
Copy link
Contributor Author

@rebornix can you take a look at this issue?

@alexdima alexdima self-assigned this Sep 18, 2019
@alexdima alexdima added the important Issue identified as high-priority label Sep 18, 2019
@alexdima alexdima added this to the August 2019 milestone Sep 18, 2019
@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Sep 18, 2019
@alexdima
Copy link
Member

Fixed via microsoft/vscode@1ce58cc

@domoritz
Copy link
Contributor Author

Thank you!

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority
Projects
None yet
Development

No branches or pull requests

5 participants