DeepCodeGeniusWeb-vscode/webpack.config.js

64 lines
1.9 KiB
JavaScript
Raw Normal View History

2023-04-14 08:05:41 +08:00
//@ts-check
2023-11-09 18:02:57 +08:00
"use strict";
2023-04-14 08:05:41 +08:00
2023-11-09 18:02:57 +08:00
const path = require("path");
2023-04-14 08:05:41 +08:00
//@ts-check
/** @typedef {import('webpack').Configuration} WebpackConfig **/
/** @type WebpackConfig */
const extensionConfig = {
2023-11-09 18:02:57 +08:00
name: "vscode extension",
target: "node", // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
mode: "none", // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
2023-04-14 08:05:41 +08:00
2023-11-09 18:02:57 +08:00
entry: "./src/extension.ts", // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
2023-04-14 08:05:41 +08:00
output: {
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
2023-11-09 18:02:57 +08:00
path: path.resolve(__dirname, "dist"),
filename: "extension.js",
libraryTarget: "commonjs2",
2023-04-14 08:05:41 +08:00
},
externals: {
2023-11-09 18:02:57 +08:00
vscode: "commonjs vscode", // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
2023-04-14 08:05:41 +08:00
// modules added here also need to be added in the .vscodeignore file
},
resolve: {
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
2023-11-09 18:02:57 +08:00
extensions: [".ts", ".json"],
},
module: {
rules: [
{
test: /\.ts?$/,
exclude: /node_modules/,
use: [
{
2023-11-09 18:02:57 +08:00
loader: "babel-loader",
options: {
presets: [
2023-11-09 18:02:57 +08:00
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
],
},
},
{
2023-11-09 18:02:57 +08:00
loader: "ts-loader",
},
],
},
2023-11-09 18:02:57 +08:00
],
},
2023-11-09 18:02:57 +08:00
devtool: "nosources-source-map",
infrastructureLogging: {
level: "log", // enables logging required for problem matchers
},
2023-12-13 15:06:05 +08:00
plugins: [
],
};
2023-12-13 15:06:05 +08:00
module.exports = extensionConfig;