-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·59 lines (58 loc) · 1.62 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
var webpack = require('webpack');
var OpenBrowserPlugin = require('open-browser-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devServer: {
historyApiFallback: true,
hot: true,
inline: true,
progress: true,
contentBase: './app',
port: 8080
},
devtool:'cheap-module-eval-source-map',
entry: {
pages: __dirname +'/app/src/router.js',
vendors:['react','react-dom','react-router']
},
output: {
publicPath: 'dist',
filename: 'js/bundle.js'
},
module: {
rules: [
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
{loader: 'style-loader' },
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]__[local]--[hash:base64:5]'
}},
{loader: 'sass-loader'}
]
},
{ test: /\.js[x]?$/, exclude: /node_modules/, loader: 'babel-loader', query: {
presets: ['es2015', 'react', 'stage-2']
} },
{
test: /favicon\.ico$/,
loader: 'file-loader?name=favicon.ico'
},
{ test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192&name=/img/[name].[ext]' },
{ test: /\.(woff|woff2|eot|ttf|svg)(\?.*$|$)/, loader: 'url-loader' }
]
},
resolve: {
extensions: ['.js', '.jsx']
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({name: 'vendors', filename: 'js/vendors.js'}),
new webpack.HotModuleReplacementPlugin(),
new OpenBrowserPlugin({ url: 'http://localhost:8080/' }),
new HtmlWebpackPlugin({favicon: 'public/favicon.ico'})
]
};