This repository has been archived by the owner on Nov 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.config.development.js
70 lines (61 loc) · 1.82 KB
/
webpack.config.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
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
'use strict';
process.env.NODE_ENV = 'development';
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const embedFileSize = 65536;
const assetsLoaders = [
{
test: /\.css$/,
loader: 'style!css?modules&sourceMap&localIdentName=[name]__[local]___[hash:base64:5]'
},
{test: /\.json$/, loader: 'json'},
{test: /\.mp4$/, loader: `url?limit=${embedFileSize}&mimetype=video/mp4`},
{test: /\.svg$/, loader: `url?limit=${embedFileSize}&mimetype=image/svg+xml`},
{test: /\.png$/, loader: `url?limit=${embedFileSize}&mimetype=image/png`},
{test: /\.jpg$/, loader: `url?limit=${embedFileSize}&mimetype=image/jpeg`},
{test: /\.gif$/, loader: `url?limit=${embedFileSize}&mimetype=image/gif`},
{
test: /\.(otf|eot|ttf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: `url?limit=${embedFileSize}`
}
];
const entry = [
'./src/reset.css',
'./src/normalize.css',
'./src/index.js'
];
module.exports = {
devtool: '#cheap-module-eval-source-map',
entry: entry.concat([
'webpack-dev-server/client?http://localhost:8080'
]),
output: {filename: 'bundle.js', path: path.resolve('example')},
plugins: [
new HtmlWebpackPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
})
],
module: {
loaders: assetsLoaders.concat([
{test: /\.js$/, loader: 'babel', include: [path.resolve('src')]}
]),
preLoaders: [
{test: /\.js$/, loader: 'eslint', include: [path.resolve('src')]}
]
},
resolve: {extensions: ['', '.js']},
stats: {colors: true},
devServer: {
hot: true,
historyApiFallback: true,
stats: {
// Do not show list of hundreds of files included in a bundle
chunkModules: false,
colors: true
}
}
};