microsoft/vscode-generator-code

how to use "vscode" module in child_process

NO-MAP opened this issue · 1 comments

NO-MAP commented

I started a child_process in my extension process:

const { fork } = require('child_process');
const childProcess = fork(scriptPath);

In my child_process script, I required the vscode module:

const vscode = require('vscode');

const document = vscode.window.activeTextEditor?.document;

Then I encountered this error:

Cannot find module 'vscode'

I understand that vscode might be a special module. In the webpack.config.js file, the vscode module is marked as externals:

externals: ['vscode']

Is there any way to use the vscode module in my extension child_process?

No, it's not a node module, but more like a global. It's only available in the extension host process.