forked from materiaalit/qt-mooc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
36 lines (35 loc) · 1.08 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
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = options => {
return {
bail: !options.isDevelopment,
entry: path.join(__dirname, 'assets', 'javascripts', 'index.js'),
devtool: options.isDevelopment ? 'eval-source-map' : '',
output: {
path: path.join(__dirname, 'source', 'javascripts'),
filename: 'scripts.js'
},
module: {
loaders: [
{
test: /.js$/,
loaders: ['babel-loader'],
exclude: /node_modules/
},
{
test: /.scss$/,
loader: ExtractTextPlugin.extract('css-loader!postcss-loader!sass-loader')
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env': JSON.stringify(options.env || {})
}),
new ExtractTextPlugin(path.join(__dirname, 'source', 'stylesheets', 'styles.css')),
options.isDevelopment ? null : new webpack.optimize.UglifyJsPlugin({ minimize: true })
].filter(p => !!p),
watch: options.isDevelopment
};
}