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

Usage in browsers #2

Open
bali182 opened this issue Jan 18, 2018 · 1 comment
Open

Usage in browsers #2

bali182 opened this issue Jan 18, 2018 · 1 comment

Comments

@bali182
Copy link

bali182 commented Jan 18, 2018

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'

@akosyakov
Copy link
Contributor

@bali182 it is expected to be used in node env as well. Please stub it for now with webpack, having 2 entry points for different envs will be useful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants