This repository has been archived by the owner on Jan 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.dev.js
77 lines (63 loc) · 1.89 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
require('react-hot-loader/patch');
var path = require('path');
var webpack = require('webpack');
var config = require('./webpack.config.base');
const HtmlWebpackPlugin = require('html-webpack-plugin');
config.debug = true;
config.devtool = 'source-map';
// Independent of Node.JS server:
config.entry = [
'webpack-dev-server/client?http://localhost:5500',
'webpack/hot/only-dev-server',
// 'react-hot-loader/patch',
config.entry
];
// Usage with Node.JS server
// config.entry = [
// 'react-hot-loader/patch',
// `webpack-hot-middleware/client?path=/__webpack_hmr`,
// `webpack/hot/dev-server`,
// config.entry
// ];
// config.output.filename = "bundle.js";
config.output.publicPath = '/';
// config.output.chunkFilename = "[name]-[chunkhash].js";
config.plugins = config.plugins.concat([
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development')
}
}),
new HtmlWebpackPlugin({
title: 'tarino development',
template: './webpack/views/index.webpack.ejs',
})
]);
config.devServer = {
colors: true,
// Enable history API fallback so HTML5 History API based
// routing works. This is a good default that will come
// in handy in more complicated setups.
historyApiFallback: true,
// Unlike the cli flag, this doesn't set
// HotModuleReplacementPlugin!
hot: true,
inline: true,
contentBase: path.resolve(__dirname, 'dist'),
// Display only errors to reduce the amount of output.
stats: 'errors-only',
// Parse host and port from env to allow customization.
//
// If you use Vagrant or Cloud9, set
// host: options.host || '0.0.0.0';
//
// 0.0.0.0 is available to all network devices
// unlike default `localhost`.
host: 'localhost', // Defaults to `localhost`
port: 5500 // Defaults to 8080
},
config.eslint = {
configFile: '.eslintrc'
};
module.exports = config;