-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
63 lines (61 loc) · 1.46 KB
/
webpack.dev.js
File metadata and controls
63 lines (61 loc) · 1.46 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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
// Check if we're in test mode via environment variable
const isTestMode = process.env.NODE_ENV === 'test';
module.exports = {
mode: 'development',
entry: isTestMode ? './src/index.ts' : './dev/index.ts',
devtool: 'inline-source-map',
stats: 'minimal',
devServer: {
host: '0.0.0.0',
static: isTestMode ? './dist' : './dev/dist',
hot: false,
liveReload: true,
client: {
overlay: { warnings: false },
},
},
output: {
filename: 'index.js',
library: {
type: 'umd',
},
clean: true,
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.ts'],
alias: {
validation: path.resolve(__dirname, 'src/index.ts'),
dev: path.resolve(__dirname, 'dev'),
},
},
module: {
rules: [
{
test: /\.(sa|sc|c)ss$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader', options: { sourceMap: true } },
{ loader: 'postcss-loader', options: { sourceMap: true } },
{ loader: 'sass-loader', options: { sourceMap: true } },
],
},
{
test: /\.ts?$/,
exclude: /node_modules/,
use: 'ts-loader',
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: isTestMode ? './tests/index.html' : './dev/index.html',
inject: 'body',
}),
],
optimization: {
minimize: false,
},
};