-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.vendor.js
81 lines (80 loc) · 1.96 KB
/
webpack.config.vendor.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
69
70
71
72
73
74
75
76
77
78
79
80
81
const path = require("path");
const webpack = require("webpack");
const safe = require("postcss-safe-parser");
//const ExtractTextPlugin = require('extract-text-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
var OptimizeCSSPlugin = require("optimize-css-assets-webpack-plugin");
module.exports = env => {
//const extractCSS = new ExtractTextPlugin('vendor.css');
const extractCSS = new MiniCssExtractPlugin("vendor.css");
const isDevBuild = !(env && env.prod);
return [
{
stats: { modules: false },
resolve: {
extensions: [".js"]
},
module: {
rules: [
{
test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/,
use: "url-loader?limit=100000"
},
//{ test: /\.css(\?|$)/, use: extractCSS.extract(['css-loader']) }
{
test: /\.css(\?|$)/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
}
]
},
entry: {
vendor: [
"bootstrap",
"bootstrap/dist/css/bootstrap.css",
"event-source-polyfill",
"vue",
"vuex",
"vue-axios-plugin",
"vue-router",
"jquery"
]
},
output: {
path: path.join(__dirname, "wwwroot", "dist"),
publicPath: "/dist/",
filename: "[name].js",
library: "[name]_[hash]"
},
plugins: [
extractCSS,
// Compress extracted CSS.
new OptimizeCSSPlugin(safe),
new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery" }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
new webpack.DllPlugin({
path: path.join(
__dirname,
"wwwroot",
"dist",
"[name]-manifest.json"
),
name: "[name]_[hash]"
}),
new webpack.DefinePlugin({
"process.env.NODE_ENV": isDevBuild
? '"development"'
: '"production"'
})
].concat(
isDevBuild
? []
: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
)
}
];
};