-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
52 lines (48 loc) · 1.06 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
const path = require('path');
const HTMLWebpackPlugin = require('html-webpack-plugin');
/**
* This is the base configuration for webpack,
* it's handling all typescript source code
*/
const config = {
entry: './src/index.ts',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
devServer: {
static: './',
hot: false,
liveReload: true
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: 'bundle/index.min.js',
path: path.resolve(__dirname, 'assets')
}
};
/**
* We can add rules depending on the mode, i.e.
* a live server on development and more.
*/
module.exports = (_env, argv) => {
// NOTE: webpack still automatically adds optimization depending on the mode flag
if (argv.mode === 'development') {
config.plugins = [
new HTMLWebpackPlugin({ template: './index.html' })
]
}
if (argv.mode === 'production') {}
return config;
}