-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
51 lines (40 loc) · 922 Bytes
/
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
var argv = require('minimist')(process.argv.slice(2));
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var config = {
entry: "./src/padloper.js",
output: {
path: __dirname+"/demo",
filename: "padloper.js",
publicPath: "/demo/"
},
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
cacheDirectory: true,
presets: ['es2015']
}
}]
},
plugins: []
};
if (argv.production) {
// PROD CONFIG
config.plugins.push(new ExtractTextPlugin('[name].css'));
config.module.loaders.push({
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
});
} else {
// DEV CONFIG
Object.assign(config, {
devtool: 'cheap-module-eval-source-map'
});
config.module.loaders.push({
test: /\.css$/,
loader: "style!css"
});
}
module.exports = config;