This repository has been archived by the owner on Jul 18, 2023. It is now read-only.
forked from prettier/prettier-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
69 lines (67 loc) · 1.95 KB
/
webpack.config.js
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* eslint-disable @typescript-eslint/no-var-requires */
"use strict";
// eslint-disable-next-line no-undef
const webpack = require("webpack");
// eslint-disable-next-line no-undef
const path = require("path");
// eslint-disable-next-line no-undef
const extensionPackage = require("./package.json");
/**@type {import('webpack').Configuration}*/
const config = {
target: "node",
entry: "./src/extension.ts",
output: {
// eslint-disable-next-line no-undef
path: path.resolve(__dirname, "dist"),
filename: "extension.js",
libraryTarget: "commonjs2",
/* cspell: disable-next-line */
devtoolModuleFilenameTemplate: "../[resource-path]",
},
plugins: [
new webpack.EnvironmentPlugin({
EXTENSION_NAME: `${extensionPackage.publisher}.${extensionPackage.name}`,
EXTENSION_VERSION: extensionPackage.version,
}),
],
/* cspell: disable-next-line */
devtool: "source-map",
externals: {
vscode: "commonjs vscode",
prettier: "commonjs prettier",
/* cspell: disable-next-line */
"spdx-exceptions": "spdx-exceptions",
/* cspell: disable-next-line */
"spdx-license-ids": "spdx-license-ids",
/* cspell: disable-next-line */
"spdx-license-ids/deprecated": "spdx-license-ids/deprecated",
"applicationinsights-native-metrics": "applicationinsights-native-metrics", // This isn't actually used, it is just to disable a webpack error we don't care about.
},
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: "ts-loader",
},
],
},
{
// vscode-nls-dev loader:
// * rewrite nls-calls
loader: "vscode-nls-dev/lib/webpack-loader",
options: {
// eslint-disable-next-line no-undef
base: path.join(__dirname, "src"),
},
},
],
},
};
// eslint-disable-next-line no-undef
module.exports = config;