-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
68 lines (66 loc) · 2.74 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
// jshint esversion: 6
(function () {
"use strict";
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const webpack = require("webpack");
(function (extractCss, webpack2) {
module.exports = (env) => {
const path = require("path");
const ManifestRevisionPlugin = require("manifest-revision-webpack-plugin");
const rootAssetPath = path.join(__dirname, "src", "lerg_files_upload", "static");
const isDevBuild = !(env && env.prod);
return {
entry: {
main: [
path.join(rootAssetPath, "css", "style.css")
],
vendor: [
"jquery",
"bootstrap",
"bootstrap/dist/css/bootstrap.css",
"font-awesome/css/font-awesome.min.css",
path.join(rootAssetPath, "js", "upload.js")
]
},
output: {
path: path.join(rootAssetPath, "dist"),
publicPath: "/static/",
filename: "[name].[hash].js",
library: "[name]_[hash]"
},
resolve: {
extensions: [".js", ".css"]
},
module: {
rules: [{
test: /\.css(\?|$)/,
use: extractCss.extract({
use: [
isDevBuild ? "css-loader" : "css-loader?minimize", "postcss-loader"
]
})
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/,
use: "url-loader?limit=100000"
}
]
},
stats: {
modules: false
},
plugins: [
new webpack2.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
}), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
extractCss,
new ManifestRevisionPlugin(path.join(rootAssetPath, "dist", "manifest.json"), {
rootAssetPath: path.join(rootAssetPath, "static"),
ignorePaths: [rootAssetPath]
})
].concat(isDevBuild ? [] : [new webpack2.optimize.UglifyJsPlugin()])
};
};
}(new ExtractTextPlugin("[name].[chunkhash].css"), webpack));
}());