-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
61 lines (56 loc) · 1.25 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
const path = require('path');
const createConfig = (options) => {
return {
watch: options.watch === true,
watchOptions:
options.watch === true
? {
ignored: ['**/*.js', '**/*.d.ts', 'node_modules/**'],
}
: {},
mode: options.mode,
devtool: options.devtool || 'source-map',
entry: './src/index.ts',
target: 'node',
output: {
path: options.output || path.resolve(__dirname, 'dist'),
filename: 'rockplate-language-server' + (options.mode === 'production' ? '.min' : '') + '.js',
libraryTarget: 'commonjs',
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader',
options: {
configFile: 'tsconfig.json',
},
},
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
};
};
module.exports = (env, argv) => {
const isDebugging = env === 'development';
const configs = [];
if (!isDebugging) {
configs.push(
createConfig({
mode: 'production',
}),
);
}
configs.push(
createConfig({
mode: 'development',
watch: true,
}),
);
return configs;
};