-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
66 lines (57 loc) · 1.94 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
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const vendor = ['react', 'react-dom', 'react-redux', 'redux', 'redux-saga', 'react-router'];
const production = !!process.env['PRODUCTION'];
module.exports = {
entry: {
'app': [
'webpack-hot-middleware/client',
'babel-polyfill',
'./src/main.js',
],
'vendor': vendor
},
output: {
filename: '[name].[hash].js',
path: path.join(__dirname, 'dist'),
publicPath: '/'
},
watch: true,
colors: true,
progress: true,
// Enable sourcemaps for debugging webpack's output.
devtool: 'source-map',
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: ['', '.webpack.js', '.web.js', '.js', 'jsx']
},
module: {
loaders: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{
test: /.jsx?$/,
loaders: ['react-hot', 'babel-loader?presets[]=es2015&presets[]=react&presets[]=stage-0'],
exclude: /node_modules/
},
{ test: /\.scss$/, loader: production
? ExtractTextPlugin.extract('css!sass')
: 'style!css?sourceMap!sass?sourceMap'
},
{ test: /\.json$/, loader: 'json' }
],
// preLoaders: [
// // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
// { test: /\.js$/, loader: 'source-map-loader' }
// ]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({ name: "vendor", filename: "vendor.js" }),
new webpack.optimize.CommonsChunkPlugin({ name: 'meta', chunks: ['vendor'], filename: "meta.js" }),
new HtmlWebpackPlugin({ title: 'Warrolight', template: 'src/index.html' }),
new ExtractTextPlugin("styles.css"),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
]
};