-
Notifications
You must be signed in to change notification settings - Fork 47
/
webpack.config.js
127 lines (123 loc) · 3.47 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const path = require("path");
const webpack = require("webpack");
const config = {
mode: "development",
entry: "./src/extension.ts",
externals: {
vscode: "commonjs vscode",
"uglify-js": "commonjs uglify-js", // Pug relies on uglify-js, which doesn't play nice with Webpack. Fortunately we don't need it, so we exclude it from the bundle
"aws-sdk": "commonjs aws-sdk", // This comes from the Sass dependency, and is an optional dependency that we don't need
fsevents: "commonjs fsevents", // This comes from the SaaS dependency, but is a native module and therefore can't be webpacked
"@microsoft/typescript-etw": "commonjs @microsoft/typescript-etw",
velocityjs: "commonjs velocityjs", // The following come from @vue/component-compiler-utils
"dustjs-linkedin": "commonjs dustjs-linkedin",
atpl: "commonjs atpl",
liquor: "commonjs liquor",
twig: "commonjs twig",
ejs: "commonjs ejs",
eco: "commonjs eco",
jazz: "commonjs jazz",
jqtpl: "commonjs jqtpl",
hamljs: "commonjs hamljs",
hamlet: "commonjs hamlet",
whiskers: "commonjs whiskers",
"haml-coffee": "commonjs haml-coffee",
"hogan.js": "commonjs hogan.js",
templayed: "commonjs templayed",
handlebars: "commonjs handlebars",
walrus: "commonjs walrus",
mustache: "commonjs mustache",
just: "commonjs just",
ect: "commonjs ect",
mote: "commonjs mote",
toffee: "commonjs toffee",
dot: "commonjs dot",
"bracket-template": "commonjs bracket-template",
ractive: "commonjs ractive",
htmling: "commonjs htmling",
"babel-core": "commonjs babel-core",
plates: "commonjs plates",
"react-dom/server": "commonjs react-dom",
react: "commonjs react",
vash: "commonjs vash",
slm: "commonjs slm",
marko: "commonjs marko",
"teacup/lib/express": "commonjs teacup",
"coffee-script": "commonjs coffee-script",
"./lib-cov/stylus": "commonjs stylus",
vue: "commonjs vue",
},
resolve: {
extensions: [".ts", ".js", ".json", ".txt"],
},
node: {
__filename: false,
__dirname: false,
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: "ts-loader",
},
],
},
{
test: /\.txt$/i,
loader: "raw-loader",
},
],
},
};
const nodeConfig = {
...config,
target: "node",
output: {
path: path.resolve(__dirname, "dist"),
filename: "extension.js",
libraryTarget: "commonjs2",
devtoolModuleFilenameTemplate: "../[resource-path]",
},
resolve: {
...config.resolve,
alias: {
"@abstractions": path.join(__dirname, "./src/abstractions/node"),
},
},
};
const webConfig = {
...config,
target: "webworker",
output: {
path: path.resolve(__dirname, "dist"),
filename: "extension-web.js",
libraryTarget: "commonjs2",
devtoolModuleFilenameTemplate: "../[resource-path]",
},
resolve: {
...config.resolve,
fallback: {
assert: false,
buffer: false,
crypto: false,
fs: false,
http: false,
https: false,
module: false,
os: require.resolve("os-browserify/browser"),
path: require.resolve("path-browserify"),
readline: false,
stream: require.resolve("stream-browserify"),
url: false,
util: false,
vm: false,
},
alias: {
"@abstractions": path.join(__dirname, "./src/abstractions/web"),
},
},
};
module.exports = [nodeConfig, webConfig];