forked from dawnlabs/alchemy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
68 lines (59 loc) · 1.43 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
var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var extractCSS = new ExtractTextPlugin('public/[name].css')
const sassLoaders = [
'css-loader',
'sass-loader'
]
module.exports = {
resolve: {
extensions: ['', '.js', '.jsx', '.css', '.sass', '.scss']
},
devtool: 'source-map',
target: 'electron',
entry: './src/index.jsx',
output: {
filename: 'public/[name].js',
chunkFilename: 'public/[id].chunk.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
query: {
cacheDirectory: true,
presets: ['react', 'es2015']
}
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.html$/,
loader: 'html'
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
loader: 'file?name=assets/[name].[hash].[ext]'
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', sassLoaders.join('!'))
}
]
},
plugins: [
// new webpack.optimize.CommonsChunkPlugin('scripts/common.js'),
new webpack.ProvidePlugin({
React: 'react'
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
'process.env.PATH': JSON.stringify(process.env.PATH)
}),
extractCSS
]
}