-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
60 lines (60 loc) · 1.63 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
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var extractCSS = new ExtractTextPlugin('stylesheets/[name].css');
var argv = require('yargs').argv;
var webpack = require('webpack');
console.log(argv);
module.exports = {
context: __dirname + "",
entry: [
"./src/client/main.js",
"./src/client/main.scss",
"./src/client/img/icons/icons.js"
],
output: {
path: __dirname + "/dist/client",
filename: "bundle.js"
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel',
query: {
plugins: ['transform-runtime'],
presets: ['es2015']
},
exclude: /node_modules/
},
{
test: /\.scss$/,
loader: extractCSS.extract(['css','sass']),
exclude: /node_modules/
},
{
test: /\.woff2$/,
loader: 'url',
exclude: /node_modules/
},
{
test: /\.svg$/,
loader: 'file?name=img/icons/[name].[ext]',
exclude: /node_modules/
},
{
test: /\.tpl\.html$/, // Only .html files
loader: 'html' // Run html loader
}
]
},
plugins:[
extractCSS,
new webpack.DefinePlugin({
WEBPACK: {
PRODUCTION:JSON.stringify(argv.dev !== undefined?false:true)
}
})
],
devServer:{
contentBase:'dist/client/'
}
};