-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dll.js
67 lines (66 loc) · 2.07 KB
/
webpack.dll.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
var path = require("path");
var webpack = require("webpack");
const TerserJSPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
module.exports = {
mode: 'production',
entry: {
vendor: [path.join(__dirname, "core", "static", "core", "vendor", "vendor.js")]
},
output: {
path: path.join(__dirname, "core", "static", "core", "vendor", "build", 'vendor'),
filename: "dll.[name].js",
library: "[name]"
},
optimization: {
minimizer: [new TerserJSPlugin({sourceMap: true,}), new OptimizeCSSAssetsPlugin({})]
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': '"production"'
}
}),
new MiniCssExtractPlugin({
filename: '[name].css',
allChunks: true
}),
new webpack.ProvidePlugin({
'_': 'lodash',
'moment': 'moment',
'Promise': 'es6-promise',
'$': 'jquery',
'jQuery': 'jquery'
}),
new webpack.DllPlugin({
path: path.join(__dirname, "core", "static", "core", "vendor", "build", "[name]-manifest.json"),
name: "[name]"
}),
],
module: {
rules: [
{
test: /\.(jsx|js)$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader']
}, {
test: /\.(jpe?g|png|gif|svg|eot|woff|ttf|svg|woff2)(\?\S*)?$/,
use: ["file-loader?mimetype=image/svg+xml"]
}
]
},
resolve: {
modules: ["node_modules"]
}
};