-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
72 lines (69 loc) · 1.59 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
const _ = require('lodash')
const Webpack = require('webpack')
const cssnano = require('cssnano')
const { resolve } = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const { NODE_ENV } = process.env
const pluginsList = [
new ExtractTextPlugin('css/styles.css'),
new Webpack.NoErrorsPlugin()
]
const prodPlugins = [
new Webpack.optimize.DedupePlugin(),
new Webpack.optimize.OccurrenceOrderPlugin(true),
new Webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
})
]
module.exports = {
noInfo: true,
target: 'node-webkit',
entry: {
main: ['babel-polyfill', './app/src/']
},
output: {
path: './app',
filename: 'js/[name].js'
},
devtool: 'cheap-module-sourcemap',
resolve: {
root: resolve('./app'),
extensions: ['', '.js', '.jsx', '.sass']
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.s.ss$/,
loader: ExtractTextPlugin.extract(
'style',
'css?modules&localIdentName="[name]-[local]-[hash:9]"' +
'&importLoaders=1!postcss!sass'
)
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css!postcss')
}
]
},
postcss: () => [cssnano],
externals: {
'react': 'React',
'react-dom': 'ReactDOM',
'snoowrap': 'snoowrap',
'lodash': '_',
'nw': 'nw'
},
plugins: _.uniq(
NODE_ENV === 'production' ? _.concat(prodPlugins, pluginsList) : pluginsList)
}