-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathwebpack.config.js
More file actions
100 lines (96 loc) · 2.19 KB
/
webpack.config.js
File metadata and controls
100 lines (96 loc) · 2.19 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
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
const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
const config = {
mode: "production",
entry: "./src/extension.ts",
externals: {
vscode: "commonjs vscode"
},
resolve: {
extensions: [".ts", ".js", ".json"]
},
node: {
__filename: false,
__dirname: false
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: "ts-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")
}
},
plugins: [
new CopyPlugin([
{
from: path.resolve(
__dirname,
"./src/abstractions/node/images/scripts/*"
),
to: path.resolve(__dirname, "./dist/scripts/"),
flatten: true
}
])
]
};
const webConfig = {
...config,
target: "webworker",
output: {
path: path.resolve(__dirname, "dist"),
filename: "extension-web.js",
libraryTarget: "commonjs2",
devtoolModuleFilenameTemplate: "../[resource-path]"
},
externals: {
...config.externals,
"simple-git": "commonjs simple-git"
},
resolve: {
...config.resolve,
alias: {
"@abstractions": path.join(__dirname, "./src/abstractions/browser"),
"simple-git": path.resolve(
__dirname,
"src/abstractions/browser/simple-git"
)
},
fallback: {
child_process: false,
crypto: false,
fs: false, // TODO: Implement file uploading in the browser
http: require.resolve("stream-http"),
https: require.resolve("https-browserify"),
os: require.resolve("os-browserify/browser"),
path: require.resolve("path-browserify"),
querystring: require.resolve("querystring-es3"),
stream: false,
url: require.resolve("url/"),
util: require.resolve("util/"),
zlib: false
}
}
};
module.exports = [nodeConfig, webConfig];