-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
69 lines (68 loc) · 1.87 KB
/
webpack.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const StyleExtHtmlWebpackPlugin = require('style-ext-html-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
const config = require('./env.config.js').development;
module.exports = {
devtool: '#cheap-module-eval-source-map',
entry: [
'webpack-dev-server/client?http://0.0.0.0:8080',
'./src/js/index.js',
'./src/styles/main.scss'
],
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: ['.js', '.jsx'],
modules: ['node_modules']
},
module: {
rules: [
{
test: /\.js?$/,
exclude: /node_modules/,
use: 'babel-loader?presets[]=es2015'
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development'),
'PUSHER_KEY': JSON.stringify(config.PUSHER_KEY),
'SERVER_URL': JSON.stringify(config.SERVER_URL)
}
}),
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({ template: './src/index.html' }),
new ExtractTextPlugin('styles.css'),
// new StyleExtHtmlWebpackPlugin(),
// new webpack.optimize.UglifyJsPlugin({ output: { ascii_only: true } })
],
devServer: {
contentBase: './dist',
watchOptions: {
aggregateTimeout: 100,
poll: 300
},
historyApiFallback: {
index: 'index.html'
},
hot: true,
host: '0.0.0.0',
port: 8080
}
};