hblang-vscode/webpack.config.js

35 lines
910 B
JavaScript
Raw Permalink Normal View History

2024-09-28 09:34:34 -05:00
const path = require('path');
module.exports = {
mode: 'production',
entry: './src/main.ts',
output: {
path: path.resolve(__dirname, 'out'),
filename: 'main.js',
libraryTarget: 'commonjs2' // This is correct for VS Code extensions
},
resolve: {
extensions: ['.ts', '.js'],
fallback: {
// For Node.js core modules not available in browser context, you set them to false
"child_process": false, // Not used in browser context
"fs": false, // Not used in browser context
"os": require.resolve("os-browserify/browser"), // Polyfill for os
"path": require.resolve("path-browserify"), // Polyfill for path
},
},
externals: {
vscode: 'commonjs vscode' // Externalize the vscode module
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
target: 'node' // Specify the target environment as Node.js
};