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

monaco-editor-webpack-plugin #1623

Closed
onlySparrow opened this issue Oct 9, 2019 · 6 comments
Closed

monaco-editor-webpack-plugin #1623

onlySparrow opened this issue Oct 9, 2019 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority typescript
Milestone

Comments

@onlySparrow
Copy link

monaco-editor v0.18.1
npm run project it will be warnings in operation How to resolve this warning

WARNING in ./node_modules/_monaco-editor@0.18.1@monaco-editor/esm/vs/language/typescript/lib/typescriptServices.js
Module not found: Error: Can't resolve '@microsoft/typescript-etw' in 'D:\Desktop\vue-backend-dev\node_modules_monaco-editor@0.18.1@monaco-editor\esm\vs\language\typescript\lib'
@ ./node_modules/_monaco-editor@0.18.1@monaco-editor/esm/vs/language/typescript/lib/typescriptServices.js
@ ./node_modules/_monaco-editor@0.18.1@monaco-editor/esm/vs/language/typescript/tsWorker.js
@ ./node_modules/_monaco-editor@0.18.1@monaco-editor/esm/vs/language/typescript/ts.worker.js

@XavierTalpe
Copy link

Also running into this, presumably since upgrading to the latest version of the monaco-editor module.
Note: I'm working on a Fedora machine.

@onlySparrow
Copy link
Author

Maybe he need to update the monaco-editor-webpack-plugin plug-in or Or he should adjust v0.18.1 compatibility . if you resolve it please tell me

@ruslan-volkov
Copy link

Same here, with monaco-editor-webpack-plugin v1.7.0, it also doesn't build with webpack in dev mode.
Downgrading to monaco-editor v0.16.2 works (higher versions might also work, didn't try them).
I'm working on macOS Mojave, tried to install @microsoft/typescript-etw' but it's win32 specific.

@onlySparrow
Copy link
Author

i'm try to down monaco-editor v0.17.0 . it has no warning.

@ecraig12345
Copy link
Member

ecraig12345 commented Oct 26, 2019

This isn't a bug with the webpack plugin, it's an issue with Monaco's (actually monaco-typescript's) current version of typescriptServices.js. Specifically this part:

try {
    etwModule = require("@microsoft/typescript-etw");
} catch (e) {
    etwModule = undefined;
}

Monaco's publishing process is supposed to strip out require calls like this to avoid breaking webpack, but this must be new and they missed it. I submitted a fix here: microsoft/monaco-typescript#49.

Until the fix gets merged and published, for this specific case you can add something like this to your webpack config as a workaround:

externals: { '@microsoft/typescript-etw': 'FakeModule' }

This tells webpack that @microsoft/typescript-etw points to a global called FakeModule and shouldn't be bundled (externals reference). Of course that global doesn't exist and trying to access it will cause an exception at runtime, but that's okay here due to the try/catch wrapper in the original code.

@alexdima
Copy link
Member

Fixed via microsoft/monaco-typescript#49

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 31, 2020
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 typescript
Projects
None yet
Development

No branches or pull requests

5 participants