-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.development.config.js
More file actions
77 lines (75 loc) · 1.81 KB
/
Copy pathwebpack.development.config.js
File metadata and controls
77 lines (75 loc) · 1.81 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
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const packageFile = require('./package.json');
const HMR_PORT = process.env.HMR_PORT || 3000;
const BUILD_DIR = path.resolve(__dirname, 'build');
const APP_DIR = path.resolve(__dirname, 'src');
module.exports = {
debug: true,
entry: [
`webpack-dev-server/client?http://0.0.0.0:${HMR_PORT}`, // WebpackDevServer host and port
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
`${APP_DIR}/index.js`,
],
output: {
path: BUILD_DIR,
filename: 'app.js',
publicPath: `http://localhost:${HMR_PORT}/`,
},
scripts: {
start: 'node server.js',
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development'),
VERSION: JSON.stringify(packageFile.version),
},
}),
new ExtractTextPlugin('stylesheet.css', {
allChunks: true,
}),
new webpack.HotModuleReplacementPlugin(),
],
module: {
preLoaders: [
{
test: /\.jsx$|\.js$/,
loader: 'eslint-loader',
include: APP_DIR,
},
],
loaders: [
{
test: /\.js?/,
include: APP_DIR,
loaders: ['react-hot', 'babel?compact=false'],
},
{
test: /\.(scss|css)$/,
loader: 'style!css!sass?sourceMap',
},
{
test: /\.(eot|ttf|wav|mp3)$/,
loader: 'url-loader',
query: {
name: '[hash].[ext]',
},
},
{
test: /\.(jpe?g|png|gif|svg)$/,
loader: 'url-loader',
query: {
limit: 150000,
name: 'img/img-[hash:6].[ext]',
},
},
],
},
devServer: {
historyApiFallback: true,
port: HMR_PORT,
inline: true,
},
};