forked from kbukum/react-es6-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.dev.js
93 lines (80 loc) · 2.51 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
"use strict";
const webpack = require("webpack");
/**
* import common webpack settings
*/
const commonSettings = require("./webpack.config.common.js");
/**
* @link https://webpack.github.io/docs/configuration.html#cache
* Cache generated modules and chunks to improve performance for multiple incremental builds.
This is enabled by default in watch mode.
* @type {boolean}
*/
commonSettings.cache = true;
/**
* @link https://webpack.github.io/docs/configuration.html#debug
* Switch loaders to debug mode.
* @type {boolean}
*/
commonSettings.debug = true;
/**
* @link https://webpack.github.io/docs/configuration.html#devtool
* Choose a developer tool to enhance debugging.
* source-map - A SourceMap is emitted. See also output.sourceMapFilename.
* @type {string}
*/
// For better development experience (debugging).
// commonSettings.devtool = "source-map";
// For faster development builds.
commonSettings.devtool = "eval";
/**
* @link https://webpack.github.io/docs/webpack-dev-server.html
* Customize the configuration of the development server.
* @type {object}
*/
commonSettings.devServer = {
historyApiFallback: true,
hot: true,
progress: true,
inline: true,
// display only errors to reduce the amount of output
// stats: "errors-only",
// parse host and port from env so this is easy
// to customize
// host: process.env.HOST,
host: "0.0.0.0",
port: 8080
};
/**
* @link https://webpack.github.io/docs/configuration.html#entry
* The entry point for the bundle.
* If you pass a string: The string is resolved to a module which is loaded upon startup.
**/
commonSettings.entry = {
app: [commonSettings.paths.app]
};
/**
* @link https://github.com/MoOx/eslint-loader
* added eslint-loader plugin for check the syntax of code by rules
*/
commonSettings.module.preLoaders.push({ test: /\.jsx?$/, loaders: ["eslint"], exclude: /node_modules/ });
commonSettings.eslint = {
configFile: ".eslintrc",
failOnWarning: false,
failOnError: true
};
/**
* @link https://webpack.github.io/docs/hot-module-replacement-with-webpack.html
* @type {HotModuleReplacementPlugin}
*/
commonSettings.plugins.push(new webpack.HotModuleReplacementPlugin());
/**
*
* @link https://github.com/ampedandwired/html-webpack-plugin
* @type {HtmlWebpackPlugin|exports|module.exports}
*/
let HtmlWebpackPlugin = require("html-webpack-plugin");
commonSettings.plugins.push(new HtmlWebpackPlugin({
template: `${commonSettings.paths.assets}/index.html`
}));
module.exports = commonSettings;