forked from arashmanteghi/webpack-react-css-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.production.config.js
63 lines (62 loc) · 1.68 KB
/
webpack.production.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
/* eslint-disable */
var path = require('path'),
webpack = require('webpack'),
autoprefixer = require('autoprefixer'),
OpenBrowserPlugin = require('open-browser-webpack-plugin'),
ExtractTextPlugin = require('extract-text-webpack-plugin'),
uglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
module.exports = {
entry: [
'babel-polyfill',
path.resolve(__dirname, 'src/app.jsx')
],
output: {
path: __dirname,
filename: './dist/bundle.js',
},
module: {
loaders: [
{
// JSX files :
test: /\.js[x]?$/,
include: path.resolve(__dirname, 'src'),
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader?presets[]=es2015&presets[]=react',
},
{
// File loader
test: /\.(eot|ttf|woff|woff2|svg|gif|png|jpeg|jpg)$/,
loader: "file-loader?name=[path][name].[ext]"
},
{
// CSS files :
test: /\.css?$/,
include: path.resolve(__dirname, 'src'),
loader: ExtractTextPlugin.extract('css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]')
},
{
// SCSS files :
test: /\.scss?$/,
include: path.resolve(__dirname, 'src'),
loader: ExtractTextPlugin.extract('css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader!sass-loader')
}
],
},
postcss: [
autoprefixer({ browsers: ['last 3 versions'] }),
],
resolve: {
extensions: ['', '.js', '.jsx'],
},
plugins: [
new webpack.optimize.DedupePlugin(),
new ExtractTextPlugin('./dist/style.css', { allChunks: true }),
new uglifyJsPlugin({
compress: {
warnings: false
}
}),
],
// Create Sourcemaps for the bundle
devtool: 'source-map',
};