forked from rakusan2/Toastmasters-Timer-Overlay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
42 lines (38 loc) · 984 Bytes
/
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
"use strict";
const path = require("path");
const { merge } = require('webpack-merge');
const LiveReloadPlugin = require('webpack-livereload-plugin');
const commonConfig = {
entry: './web/src/web.ts',
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: { projectReferences: true }
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: 'web.js',
path: path.resolve(__dirname, 'web'),
},
};
const prodConfig = {
mode: 'production',
};
const devConfig = {
mode: 'development',
devtool: 'inline-source-map',
plugins: [
new LiveReloadPlugin({ appendScriptTag: true })
]
};
module.exports = env => {
if (env.development) return merge(commonConfig, devConfig);
else if (env.production) return merge(commonConfig, prodConfig);
else throw new Error("No Config Found");
}