Closed BusinessDuck closed 1 year ago
import type * as monaco from 'monaco-editor/esm/vs/editor/editor.api'; cause error in typescript project with monaco-editor-core package only.
That's weird because this code shouldn't be in the output javascript
Also monaco-editor depends from monaco-editor-core, may be make a sense change types import to core?
monaco-editor-core is not a dependency of monaco-editor, it's just there during the build and everything is duplicated/built from it, so it's not possible
We changed the dependency from monaco-editor-core
to monaco-editor
in the examples, because "limiting" the dependency to monaco-editor-core
prevents users the simply include other monaco-editor features without requiring hacks.
Our reasoning was simple. You can achieve the same by importing a sub-set of monaco-editor
instead of relying to monaco-editor-core
.
That's weird because this code shouldn't be in the output javascript
It's error from typing d.ts
files. monaco-editor-core
or monaco-editor
should be a devDependency, because typing files (for developing mode) have imports from that module.
It's error from typing d.ts files. monaco-editor-core or monaco-editor should be a devDependency
Thank you, this devDependency was never stated in the package.json of the lib (core or not), so at least I wasn't aware there was an impact beyond the examples.
@BusinessDuck due to the latest changes with v2.0.0+ we have a direct dependency to monaco-editor
. See npm list output with depth 1:
└─┬ monaco-languageclient@2.0.2 -> .\packages\client
├── @types/glob-to-regexp@0.4.1
├── @types/node@16.11.7
├── @types/vscode@1.68.0
├── glob-to-regexp@0.4.1
├── vscode-jsonrpc@8.0.1
├─┬ vscode-languageclient@8.0.1
│ ├── minimatch@3.1.2
│ ├── semver@7.3.7
│ └── vscode-languageserver-protocol@3.17.1
├── vscode-languageserver-textdocument@1.0.5
├── vscode-uri@3.0.3
└─┬ vscode@npm:@codingame/monaco-vscode-api@1.68.4
└── monaco-editor@0.33.0
We will add a workaround section to the README to make the problem visible to people, but we recommend to use monaco-editor
and selectively import what is required.
We have added a new Troubleshooting section in the README that also provides help regarding monaco-editor-core.
I tried changing tsconfig.json, still it showing error.
The problem:
import type * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
cause error in typescript project withmonaco-editor-core
package only.Hack solution:
tsconfig.json
Would you like to use
monaco-editor
package as peer-dependency? Alsomonaco-editor
depends frommonaco-editor-core
, may be make a sense change types import to core?