Skip to content
This repository was archived by the owner on Jun 29, 2022. It is now read-only.
This repository was archived by the owner on Jun 29, 2022. It is now read-only.

Usage in browsers #2

Description

@bali182

Looking at the example here: https://github.com/TypeFox/monaco-languageclient/blob/master/example/src/client.ts I got the impression that this package is meant to be consumed in the browser. However when I try the above sample (instead of typescript I'm just using js), there is an error because vscode-jsonrpc (used by this module) seems to require the net module which is obviously not available for browsers.

Is this expected? Should I just polyfill the net module?

ERROR in ./node_modules/vscode-jsonrpc/lib/pipeSupport.js
Module not found: Error: Can't resolve 'net' in '/Users/balazs.edes/code/studio-prototype-bitbucket/node_modules/vscode-jsonrpc/lib'
 @ ./node_modules/vscode-jsonrpc/lib/pipeSupport.js 10:12-26
 @ ./node_modules/vscode-jsonrpc/lib/main.js
 @ ./node_modules/vscode-ws-jsonrpc/lib/index.js
 @ ./src/components/TempEditorScreen/connectWithLanguageServer.js
 @ ./src/components/TempEditorScreen/index.js
 @ ./src/components/App/index.js
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:3000 ./src/index.js

ERROR in ./node_modules/vscode-jsonrpc/lib/socketSupport.js
Module not found: Error: Can't resolve 'net' in '/Users/balazs.edes/code/studio-prototype-bitbucket/node_modules/vscode-jsonrpc/lib'
 @ ./node_modules/vscode-jsonrpc/lib/socketSupport.js 7:12-26
 @ ./node_modules/vscode-jsonrpc/lib/main.js
 @ ./node_modules/vscode-ws-jsonrpc/lib/index.js
 @ ./src/components/TempEditorScreen/connectWithLanguageServer.js
 @ ./src/components/TempEditorScreen/index.js
 @ ./src/components/App/index.js
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:3000 ./src/index.js

The error happens just after I require listen:

import { listen } from 'vscode-ws-jsonrpc'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions