-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
60 lines (59 loc) · 2.37 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
// jshint esversion: 6
(function () {
"use strict";
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const webpack = require("webpack");
(function (extractCss, webpack2) {
module.exports = (env, argv) => {
const path = require("path");
const BundleTracker = require("webpack-bundle-tracker");
const rootAssetPath = path.join(__dirname, "static");
const isDevMode = argv.mode === 'development';
return {
entry: {
main: [
path.join(rootAssetPath, "css", "main.css"),
path.join(rootAssetPath, "img", "background.png")
],
vendor: [
"jquery", // jQuery is required by taggit-selectize
"bootstrap",
"bootstrap/dist/css/bootstrap.css"
],
selectize: [path.join(rootAssetPath, "css", "taggit_selectize", "css", "selectize.bootstrap3.css")]
},
output: {
path: path.join(rootAssetPath, "static"),
publicPath: "/static/",
filename: "[name].[hash].js",
library: "[name]_[hash]"
},
module: {
rules: [{
test: /jquery\.(jsx|js)$/,
loader: "expose-loader?jQuery"
},
{
test: /\.css(\?|$)/,
use: extractCss.extract({
use: [
isDevMode ? "css-loader" : "css-loader?minimize", "postcss-loader"
]
})
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/,
use: "url-loader?limit=100000"
}
]
},
plugins: [
extractCss,
new BundleTracker({
filename: path.join("static", "manifest.json")
})
]
};
};
}(new ExtractTextPlugin("[name].[chunkhash].css"), webpack));
}());