TypeFox / monaco-languageclient

Repo hosts npm packages for monaco-languageclient, vscode-ws-jsonrpc, monaco-editor-wrapper, @typefox/monaco-editor-react and monaco-languageclient-examples
https://www.npmjs.com/package/monaco-languageclient
MIT License
1.06k stars 177 forks source link

help me find a solution to these errors when importing this package #589

Closed DennisKost closed 9 months ago

DennisKost commented 10 months ago

Help me find a solution to these errors when importing this package. I am using vite, code for vite.config.ts added from https://github.com/TypeFox/monaco-languageclient/blob/main/vite.config.ts

main dependencies: "monaco-editor": "^0.45.0", "monaco-languageclient": "^7.3.0", "vscode": "npm:@codingame/monaco-vscode-api@~1.85.0"

Truncated error log: X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/product/common/productService.js"

node_modules/vscode/services.js:10:32:
  10 │ import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
     ╵                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/product/common/productService.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/product/common/productService.js"

node_modules/vscode/localExtensionHost.js:17:32:
  17 │ import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
     ╵                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/product/common/productService.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/userDataProfile/common/userDataProfile.js"

node_modules/vscode/localExtensionHost.js:18:41:
  18 │ import { IUserDataProfilesService } from 'monaco-editor/esm/vs/platform/userDataProfile/common/userDataProfile.js';
     ╵                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/userDataProfile/common/userDataProfile.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/remote/common/remoteHosts.js"

node_modules/vscode/vscode/src/vs/platform/telemetry/common/telemetryUtils.js:2:30:
  2 │ import { getRemoteName } from 'monaco-editor/esm/vs/platform/remote/common/remoteHosts.js';
    ╵                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/remote/common/remoteHosts.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/files/browser/htmlFileSystemProvider.js"

node_modules/@codingame/monaco-vscode-files-service-override/index.js:4:39:
  4 │ export { HTMLFileSystemProvider } from 'monaco-editor/esm/vs/platform/files/browser/htmlFileSystemProvider.js';
    ╵                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/files/browser/htmlFileSystemProvider.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/common/json.js"

node_modules/vscode/vscode/src/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.js:3:35:
  3 │ import { parse, getNodeType } from 'monaco-editor/esm/vs/base/common/json.js';
    ╵                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/common/json.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/browser/indexedDB.js"

node_modules/@codingame/monaco-vscode-files-service-override/index.js:5:26:
  5 │ export { IndexedDB } from 'monaco-editor/esm/vs/base/browser/indexedDB.js';
    ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/browser/indexedDB.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/common/performance.js"

node_modules/vscode/vscode/src/vs/workbench/common/contributions.js:5:21:
  5 │ import { mark } from 'monaco-editor/esm/vs/base/common/performance.js';
    ╵                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/common/performance.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js"

node_modules/@codingame/monaco-vscode-model-service-override/vscode/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.js:14:36:
  14 │ import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
     ╵                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/common/performance.js"

node_modules/vscode/vscode/src/vs/workbench/api/common/extensionHostMain.js:2:29:
  2 │ import * as performance from 'monaco-editor/esm/vs/base/common/performance.js';
    ╵                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/common/performance.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] import_meta.resolve is not a function [plugin import.meta.url]

vite.config.ts:184:0:
  184 │ 
      ╵ ^

..... The plugin "import.meta.url" was triggered by this import

node_modules/@codingame/monaco-vscode-extensions-service-override/index.js:1:73:
  1 │ export { ExtensionServiceOverride, default, setLocalExtensionHost } from './extensions.js';
    ╵  

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/common/performance.js"

node_modules/vscode/vscode/src/vs/workbench/api/common/extHostExtensionService.js:4:29:
  4 │ import * as performance from 'monaco-editor/esm/vs/base/common/performance.js';
    ╵                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/common/performance.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js"

node_modules/vscode/missing-services.js:6:36:
  6 │ import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
    ╵                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/common/stream.js"

node_modules/@codingame/monaco-vscode-files-service-override/vscode/src/vs/platform/files/common/inMemoryFilesystemProvider.js:5:35:
  5 │ import { newWriteableStream } from 'monaco-editor/esm/vs/base/common/stream.js';
    ╵                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/common/stream.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/common/json.js"

node_modules/vscode/extensions.js:9:22:
  9 │ import { parse } from 'monaco-editor/esm/vs/base/common/json.js';
    ╵                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/common/json.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/common/performance.js"

node_modules/vscode/vscode/src/vs/workbench/api/common/extHostRequireInterceptor.js:2:29:
  2 │ import * as performance from 'monaco-editor/esm/vs/base/common/performance.js';
    ╵                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/common/performance.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/product/common/productService.js"

node_modules/vscode/missing-services.js:13:32:
  13 │ import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
     ╵                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/product/common/productService.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/common/performance.js"

node_modules/vscode/vscode/src/vs/workbench/services/textfile/common/textFileEditorModel.js:4:21:
  4 │ import { mark } from 'monaco-editor/esm/vs/base/common/performance.js';
    ╵                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/common/performance.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/files/browser/htmlFileSystemProvider.js"

node_modules/@codingame/monaco-vscode-files-service-override/files.js:14:39:
  14 │ export { HTMLFileSystemProvider } from 'monaco-editor/esm/vs/platform/files/browser/htmlFileSystemProvider.js';
     ╵                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/files/browser/htmlFileSystemProvider.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/remote/common/remoteHosts.js"

node_modules/vscode/vscode/src/vs/workbench/api/common/extHostTelemetry.js:7:30:
  7 │ import { getRemoteName } from 'monaco-editor/esm/vs/platform/remote/common/remoteHosts.js';
    ╵                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/remote/common/remoteHosts.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/browser/indexedDB.js"

node_modules/@codingame/monaco-vscode-files-service-override/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js:10:30:
  10 │ import { DBClosedError } from 'monaco-editor/esm/vs/base/browser/indexedDB.js';
     ╵                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/browser/indexedDB.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/common/json.js"

node_modules/vscode/tools/l10n.js:3:35:
  3 │ import { parse, getNodeType } from 'monaco-editor/esm/vs/base/common/json.js';
    ╵                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/common/json.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/platform/product/common/productService.js"

node_modules/vscode/vscode/src/vs/workbench/services/extensions/common/extensionsRegistry.js:9:32:
  9 │ import { productSchemaId } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
    ╵                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/platform/product/common/productService.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "monaco-editor/esm/vs/base/browser/indexedDB.js"

node_modules/@codingame/monaco-vscode-files-service-override/files.js:19:26:
  19 │ import { IndexedDB } from 'monaco-editor/esm/vs/base/browser/indexedDB.js';
     ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "monaco-editor/esm/vs/base/browser/indexedDB.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

kaisalmen commented 10 months ago

Hi @DennisKost are you aware of this: https://github.com/TypeFox/monaco-languageclient#overrides-instructions and read this troubleshooting advice? https://github.com/TypeFox/monaco-languageclient#dependency-issues-monaco-editor--codingamemonaco-editor-treemended

DennisKost commented 9 months ago

Hi @DennisKost are you aware of this: https://github.com/TypeFox/monaco-languageclient#overrides-instructions and read this troubleshooting advice? https://github.com/TypeFox/monaco-languageclient#dependency-issues-monaco-editor--codingamemonaco-editor-treemended

thank you, this part of the problem is solved