-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
80 lines (73 loc) · 1.79 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const WebpackShellPlugin = require('webpack-shell-plugin');
const onBuildEnd = process.env.NODE_ENV === 'development' ? 'npm run start:electron' : '';
const webpackShellPlugin = new WebpackShellPlugin({
onBuildStart: [`echo Webpack is running in ${process.env.NODE_ENV}`],
onBuildEnd: [onBuildEnd]
});
module.exports = {
entry: [
path.join(__dirname, '/src/index.jsx'),
path.join(__dirname, '/src/styles/base.scss'),
],
output: {
path: path.join(__dirname, '/webapp'),
filename: 'bundle.js'
},
devtool: 'source-map',
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx'],
root: [
path.resolve(__dirname, 'src')
]
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './src/index.html'
}),
new ExtractTextPlugin('app.min.css'),
webpackShellPlugin
],
module: {
loaders: [
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('css!sass')
},
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['babel']
},
{
test: /\.jsx$/,
exclude: /node_modules/,
loaders: ['babel']
},
{
test: /\.html$/,
loaders: ['html']
},
{
test: /\.json$/,
loaders: ['json']
},
{
test: /\.svg$/,
loaders: ['url']
}
],
preLoaders: [
{ test: /\.js$/, include: [/src/], loader: 'source-map-loader' },
]
},
postcss: function() {
return [
require('autoprefixer')
]
},
target: 'electron-renderer'
};