forked from siamak/react-for-developers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
90 lines (82 loc) · 1.8 KB
/
Copy pathwebpack.config.js
File metadata and controls
90 lines (82 loc) · 1.8 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
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
/* eslint-disable */
var path = require('path'),
webpack = require('webpack'),
autoprefixer = require('autoprefixer'),
precss = require('precss'),
cssnano = require('cssnano'),
OpenBrowserPlugin = require('open-browser-webpack-plugin');
var configServe = {
port: 3000,
};
module.exports = {
devServer: {
hot: true,
inline: true,
historyApiFallback: true,
progress: true,
port: configServe.port,
},
entry: [
'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:' + configServe.port,
path.resolve(__dirname, './src/app.js'),
],
output: {
path: __dirname,
filename: './dist/bundle.js',
},
module: {
loaders: [
{
test: /\.js?$/,
include: path.resolve(__dirname, 'src'),
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.css?$/,
include: path.resolve(__dirname, 'src'),
loader: 'style-loader!css-loader!postcss-loader',
},
{
test: /\.json$/,
loader: "json-loader"
},
{
test: /\.(woff|svg)$/,
include: path.resolve(__dirname, 'src/assets/'),
loader: 'file-loader',
query: {
name: 'font/[hash].[ext]',
limit: 5000,
mimetype: 'application/font-woff'
}
},
],
},
postcss: [
autoprefixer({ browsers: ['last 3 versions'] }),
precss(),
cssnano()
],
plugins: [
// Avoid publishing files when compilation fails
new webpack.NoErrorsPlugin(),
new webpack.IgnorePlugin(/\/iconv-loader$/),
new webpack.HotModuleReplacementPlugin(),
new OpenBrowserPlugin({ url: 'http://localhost:' + configServe.port })
],
resolve: {
extensions: ['', '.js', '.jsx'],
},
stats: {
// Nice colored output
colors: true,
},
node: {
net: 'empty',
tls: 'empty'
},
// Create Sourcemaps for the bundle
devtool: 'source-map',
};