-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
webpack.prod.js
115 lines (111 loc) · 2.59 KB
/
webpack.prod.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
const {merge} = require('webpack-merge');
const common = require('./webpack.common.js');
const glob = require('glob-all');
const path = require('path');
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const PurgeCssPlugin = require('purgecss-webpack-plugin');
const SentryPlugin = require("@sentry/webpack-plugin");
const webpack = require('webpack');
const plugins = [
new PurgeCssPlugin({
paths: glob.sync([
path.join(__dirname, 'app/**/*.php'),
path.join(__dirname, 'resources/views/**/*.twig'),
path.join(__dirname, 'resources/js/components/**/*.vue'),
path.join(__dirname, 'resources/js/**/*.ts'),
path.join(__dirname, 'resources/js/**/*.js'),
path.join(__dirname, 'survey/**/*.*'),
]),
safelist: {
standard: [
'footer-bubble',
'line-numbers',
'line-numbers-rows',
'token',
'keyword',
'comment',
'prolog',
'doctype',
'cdata',
'punctuation',
'namespace',
'property',
'tag',
'boolean',
'number',
'constant',
'modal-backdrop',
'show',
'fade',
'pre',
'kbd',
'code',
'video',
'breadcrumb-fixed',
'mention',
'user-deleted',
'strikeout',
'ajax-loader',
'link-broken',
'[aria-label]',
'x-placement',
'tox-notifications-container',
'editor-4play',
'menu-group-service-operations',
'menu-group-moderator-actions',
'divider',
'vue-notification-group',
'vue-notification-wrapper',
],
deep: [
/^logo/,
/^language/,
/^badge/,
/^depth/,
/^cm/,
],
greedy: [
/hire-me$/,
/dropdown-menu/,
/^tooltip/,
/^bs-tooltip/,
/^ps/,
/^cool-lightbox/,
/^tag/,
/:not/,
/^pre/,
/^popover/,
/revive/,
/^fa-/,
],
},
}),
new webpack.EnvironmentPlugin({
'FRONTEND_SENTRY_DSN': null,
'VAPID_PUBLIC_KEY': null,
'RELEASE': null,
}),
];
if (process.env.RELEASE) {
plugins.push(new SentryPlugin({
include: "./public",
authToken: process.env.SENTRY_API_KEY,
release: process.env.RELEASE,
ignore: ["node_modules"],
org: "coyote",
project: "frontend",
}));
}
module.exports = merge(common, {
mode: "production",
optimization: {
chunkIds: 'named',
minimize: true,
usedExports: true,
minimizer: [
'...',
new CssMinimizerPlugin(),
],
},
plugins,
});