-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
51 lines (47 loc) · 1.23 KB
/
webpack.dev.js
File metadata and controls
51 lines (47 loc) · 1.23 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
/* eslist-disable */
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin')
const PATHS = {
src: path.join(__dirname, 'src'),
app: path.join(__dirname, 'src/app.js'),
build: path.join(__dirname, 'build')
};
var webpackconfig = {
entry: {
app: [
'webpack-dev-server/client' + '?/',
'webpack/hot/dev-server',
PATHS.app
]
},
output: {
path: PATHS.build,
filename: '[name].js',
publicPath: '/'
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(PATHS.src, 'index.html'),
chunksSortMode: 'dependency',
filename: 'index.html',
inject: 'body',
}),
new webpack.HotModuleReplacementPlugin(), // Auto refresh page
]
}
new WebpackDevServer(webpack(webpackconfig), {
historyApiFallback: true, // Allows reloading of any URL
hot: true, // Auto refresh page
publicPath: webpackconfig.output.publicPath, // Public bath
quiet: false, // Hides Errors
watchOptions: {
ignored: /node_modules/
}
}).listen(3000, (err, result) => {
if (err) {
return console.log(err);
}
console.log('Starting the development server on port 3000');
});