-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
47 lines (46 loc) · 1.24 KB
/
webpack.dev.config.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
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const precss = require('precss');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const BUILD_DIR = path.resolve(__dirname, 'public');
const APP_DIR = path.resolve(__dirname, 'src');
module.exports = {
devtool: 'eval',
entry: [
'babel-polyfill',
'webpack-hot-middleware/client',
`${APP_DIR}/js/index.js`
],
output: {
path: BUILD_DIR,
filename: 'bundle.js',
publicPath: '/'
},
resolve: {
extensions: ['', '.js', '.jsx', '.css', '.scss'],
modulesDirectories: ['src', 'node_modules']
},
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /(node_modules)|(bower_components)/,
loader: 'babel'
}, {
test: /\.s?css$/,
loader: ExtractTextPlugin.extract('style', 'css?-autoprefixer!postcss!sass'),
include: /(src)|(node_modules)/
}]
},
postcss() {
return [autoprefixer, precss];
},
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin('style.css', { allChunks: true })
]
};