discord-vscode/webpack.config.js

51 lines
1 KiB
JavaScript
Raw Normal View History

2021-02-10 03:24:42 +00:00
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-require-imports */
2019-07-24 13:49:01 +00:00
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
2020-12-20 11:16:48 +00:00
const path = require('path');
2021-02-10 03:24:42 +00:00
/** @type {import('webpack').Configuration} */
module.exports = {
target: 'node',
entry: './src/extension.ts',
output: {
filename: 'extension.js',
2019-09-22 16:56:19 +00:00
libraryTarget: 'commonjs2',
2020-12-20 11:16:48 +00:00
path: path.resolve(process.cwd(), 'dist'),
},
devtool: 'source-map',
externals: {
2019-09-22 16:56:19 +00:00
vscode: 'commonjs vscode',
},
resolve: {
2019-09-22 16:56:19 +00:00
extensions: ['.ts', '.js', '.json'],
},
2019-09-22 16:56:19 +00:00
plugins: [new CleanWebpackPlugin()],
optimization: {
2020-12-20 11:16:48 +00:00
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: true,
terserOptions: {
2020-12-20 11:16:48 +00:00
output: {
comments: false,
},
mangle: false,
keep_classnames: true,
2019-09-22 16:56:19 +00:00
keep_fnames: true,
},
}),
],
},
module: {
2019-09-22 16:56:19 +00:00
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
};