I have been working on vscode extension and I tried bundling it using Webpack. My project uses another project, that has been linked in node_modules. I can't activate extension using bundled js file. 3rd party library in nested project uses sync-rpc, which has dynamic require call in it. It causes:
WARNING in ../twx-service-helper/node_modules/sync-rpc/lib/worker.js 52:10-27
Critical dependency: the request of a dependency is an expression
I tried using nodeExternals to externailze node_modules, tried externalizing sync-rpc in Webpack.config.js, removing request calls in nested project, updating sync-rpc, deleting package-lock.json file and executing npm install, but nothing works. My Webpack.config.js:
const path = require("path");
module.exports = {
target: "node",
mode: "production",
entry: "./src/extension.ts",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "out"),
},
devtool: "none",
module: {
rules: [
{
test: /\.ts$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".ts", ".js"],
},
externals: {
vscode: "commonjs vscode",
},
};