-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
49 lines (43 loc) · 1.45 KB
/
webpack.config.dev.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
const path = require('path');
const { merge } = require('webpack-merge');
const loadConfig = require('./webpack/load-config');
const commonConfig = require('./webpack.common');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const ForkTsCheckerNotifierWebpackPlugin = require('fork-ts-checker-notifier-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const config = (env) => {
const applicationName = env.APP_NAME;
const applicationConfig = loadConfig();
const defaultWebpackConfig = commonConfig(applicationName);
return merge(defaultWebpackConfig, {
mode: 'development',
target: 'web',
devServer: {
static: path.join(__dirname, 'public'),
hot: true,
compress: true,
port: 8080,
},
output: {
filename: '[name].js',
path: path.join(__dirname, 'dist'),
libraryTarget: 'umd',
},
plugins: [
/* Create HTML template file */
new HtmlWebpackPlugin({
inject: true,
scriptLoading: 'blocking',
templateParameters: {
'config': JSON.stringify(applicationConfig)
},
template: path.join(__dirname, 'public', `${applicationName}.html`),
}),
/* Fork TypeScript process */
new ForkTsCheckerWebpackPlugin(),
/* Display TypeScript compilation notifications */
new ForkTsCheckerNotifierWebpackPlugin({ excludeWarnings: true }),
]
});
};
module.exports = config;