forked from opensourcehk/kaidemo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
57 lines (54 loc) · 1.49 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
'use strict';
const UglifyPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
const OccurenceOrderPlugin = require('webpack/lib/optimize/OccurrenceOrderPlugin');
const DedupePlugin = require('webpack/lib/optimize/DedupePlugin');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');
const webpack = require('webpack');
module.exports = {
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin('bundle.css', { allChunks: true }),
new UglifyPlugin({minimize: true}),
new OccurenceOrderPlugin(),
new DedupePlugin()
],
external: {
},
devtool: 'source-map',
entry: {
app: './assets/js/index.jsx'
},
output: {
path: `${__dirname}/public/js`,
publicPath: '/js',
filename: '[name].js'
},
resolve: {
extensions: ['', '.jsx', '.scss', '.js', '.json', '.css' ],
fallback: ['node_modules']
},
resolveLoader: {
fallback: ['node_modules']
},
postcss: [autoprefixer],
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['react-hot', 'jsx', 'babel']
},
{
test: /\.jsx$/,
exclude: /node_modules/,
loaders: ['react-hot', 'jsx', 'babel']
},
{
test: /(\.scss|\.css)$/,
loader: ExtractTextPlugin.extract('style', 'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass')
}
]
}
};