-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathwebpack.config.babel.js
71 lines (70 loc) · 1.71 KB
/
webpack.config.babel.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
70
71
import path from 'path';
import webpack from 'webpack';
import autoprefixer from 'autoprefixer';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
module.exports = {
entry: './src/index.js',
output: {
path: './build',
filename: 'bundle.js'
},
resolve: {
modulesDirectories: [
path.resolve(__dirname, 'node_modules'),
'node_modules'
],
extensions: ['', '.jsx', '.scss', '.js', '.json'],
alias: {
'react': 'preact-compat',
'react-dom': 'preact-compat',
'react-addons-css-transition-group': 'rc-css-transition-group'
}
},
module: {
preLoaders: [
// {
// exclude: /src\//,
// loader: 'source-map'
// }
],
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel'
},
{
test: /\.s?css$/,
loader: ExtractTextPlugin.extract('style', 'css?sourceMap&modules&importLoaders=1&localIdentName=[local]__[hash:base64:5]!postcss!sass?sourceMap!toolbox')
}
]
},
toolbox: {
theme: path.join(__dirname, 'src/toolbox-theme.scss')
},
postcss: [autoprefixer],
plugins: ([
new webpack.NoErrorsPlugin(),
new webpack.optimize.DedupePlugin(),
new ExtractTextPlugin('style.css', { allChunks: true }),
new HtmlWebpackPlugin({
template: 'src/index.html'
})
]).concat(process.env.ENVIRONMENT==='production' ? [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
output: { comments: false }
})
] : []),
stats: { colors: true },
devtool: 'source-map',
devServer: {
port: process.env.PORT || 8080,
contentBase: './src',
historyApiFallback: true
}
};