forked from ChristianEdwardPadilla/ReacType
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.development.js
44 lines (43 loc) · 1.54 KB
/
webpack.development.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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const merge = require('webpack-merge');
const base = require('./webpack.config');
const path = require('path');
const nonce = require('./app/src/utils/createNonce')();
const {DEV_PORT} = require('./config');
// merges webpack.config.js with development specific configs
module.exports = merge(base, {
// sets process.env.NODE_ENV to 'development;
mode: 'development',
devtool: 'inline-source-map',
devServer: {
host: 'localhost',
port: '8080',
hot: true, // Hot-reload this server if changes are detected
compress: true, // Compress (gzip) files that are served
contentBase: path.resolve(__dirname, 'app/dist'), // Where we serve the local dev server's files from
watchContentBase: true, // Watch the content base for changes
watchOptions: {
ignored: /node_modules/
},
proxy: {
'/demoRender': {
target: `http://localhost:${DEV_PORT}/`
},
'/user-styles': {
target: `http://localhost:${DEV_PORT}/`
}
}
},
plugins: [
// miniCssExtractPlugin is included here because it's used as a loader in wepack.config.js
new MiniCssExtractPlugin(),
// simplifies creation of HTML files that serve webpack bundles
// creates a index.html file in the dist folder using index.html as a template
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'app/src/public/index.ejs'),
filename: 'index.html',
nonce: nonce
})
]
});