-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
53 lines (49 loc) · 1.63 KB
/
Copy pathwebpack.config.js
File metadata and controls
53 lines (49 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'use strict';
const path = require('path');
const webpack = require('webpack');
/** @type {import('webpack').Configuration} */
const config = {
target: 'node', // VS Code extensions run in Node.js environment, change this if you are targeting a different environment
entry: './src/extension.js', // Entry point of the extension
output: {
path: path.resolve(__dirname, 'dist'), // Output directory
filename: 'extension.js', // Output file
libraryTarget: 'commonjs2', // CommonJS2 module format
devtoolModuleFilenameTemplate: '../[resource-path]' // For source maps
},
devtool: 'source-map', // Generate source maps for development
externals: {
vscode: 'commonjs vscode' // Exclude vscode module from bundle
},
resolve: {
// Configure how modules are resolved
mainFields: ['browser', 'module', 'main'], // Look for `browser`, `module`, then `main` entry points in node modules
extensions: ['.js'], // Resolve JavaScript files
alias: {
// Optional: Add path aliasing if needed
},
fallback: {
// Optional: Provide fallbacks for core Node.js modules if needed
}
},
module: {
rules: [
{
test: /\.js$/, // Process JavaScript files
exclude: /node_modules/, // Exclude node_modules directory
use: {
loader: 'babel-loader', // Use Babel for JavaScript transpiling (optional)
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
})
]
};
module.exports = config;