-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.js
84 lines (74 loc) · 2.32 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// const ESLintPlugin = require('eslint-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const OptimizeCSSAssetsPlugin = require("css-minimizer-webpack-plugin")
const TerserJSPlugin = require("terser-webpack-plugin")
const VueLoaderPlugin = require("vue-loader/lib/plugin")
const path = require("path")
module.exports = {
entry: ["./src/main/js/index.js"],
mode: "production",
devtool: "source-map",
output: {
path: path.resolve(__dirname, "src/main/resources/assets/journeymap/web/bundled"),
filename: "bundle.js",
},
plugins: [
// new ESLintPlugin({
// exclude:[
// "node_modules",
// "src/main/resources"
// ]
// }),
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css",
}),
],
optimization: {
minimizer: [
new TerserJSPlugin({}),
new OptimizeCSSAssetsPlugin({}),
],
},
resolve: {
alias: {
vue$: "vue/dist/vue.esm.js",
},
extensions: ["*", ".js", ".vue", ".json"],
},
module: {
rules: [
{ // Use babel to transpile JS files to older versions
test: /\.m?js$/,
exclude: /(node_modules|bower_components|src\/main\/resources)/,
use: {
loader: "babel-loader",
options: {
cacheDirectory: true,
presets: ["@babel/preset-env"],
},
},
},
{ // Extract and bundle imported CSS files and minify them
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
{ // Extract and bundle imported image files
test: /\.(png|jpe?g|gif|ico)$/i,
use: [
{
loader: "file-loader",
options: {
publicPath: "bundled",
},
},
],
},
{ // Vue template files
test: /\.vue$/,
loader: "vue-loader",
},
],
},
}