This repository has been archived by the owner on May 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
90 lines (86 loc) · 2.46 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ENV = process.env.BABEL_ENV = process.env.NODE_ENV || 'development';
const AUTOPREFIXER_BROWSERS = [
'Android 2.3',
'Android >= 4',
'Chrome >= 35',
'Firefox >= 31',
'Explorer >= 9',
'iOS >= 7',
'Opera >= 12',
'Safari >= 7.1',
];
module.exports = {
debug: true,
devtool: '#eval-source-map',
context: __dirname,
stats: {
colors: true,
timings: true,
chunks: true,
chunkModules: true,
cached: true,
cachedAssets: true
},
entry: [
'webpack-hot-middleware/client?path=/__webpack_hmr',
'babel-polyfill',
'./src/index.js'
],
output: {
path: path.join(__dirname, 'public/assets'),
publicPath: '/assets',
filename: 'app.bundle.js'
},
resolve: {
extensions: ['', '.jsx', '.scss', '.css', '.js', '.json'],
root: ['./src/styles/globals']
},
plugins: [
new webpack.DefinePlugin({
'__DEV__': ENV === 'development',
'__TEST__': ENV === 'test',
'__CLIENT__': true,
'process.env': {
'NODE_ENV': JSON.stringify(ENV),
'BABEL_ENV': JSON.stringify(ENV)
}
}),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new ExtractTextPlugin('styles.css', { allChunks: true })
],
module: {
loaders: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.(scss|css)$/,
include: path.join(__dirname, 'src/styles'),
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?importLoaders=2&sourceMap&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true')
},
//{
// test: /\.(scss|css)$/,
// exclude: path.join(__dirname, 'src/styles'),
// loader: 'style-loader!css-loader?modules&importLoaders=2&sourceMap&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true!toolbox-loader'
//},
{
test: /\.(png|jpg|gif|ico|svg)$/,
loader: 'url-loader?limit=10000'
}
]
},
//toolbox: {
// theme: './src/styles/custom/_theme.scss'
//},
postcss: [
autoprefixer({ browsers: AUTOPREFIXER_BROWSERS })
]
};