forked from ffmpegwasm/vue-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
55 lines (54 loc) · 1.53 KB
/
vue.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
const zlib = require('zlib');
const path = require("path");
const express = require("express");
const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
outputDir: "dist",
indexPath: "index.html",
transpileDependencies: false,
productionSourceMap: true,
runtimeCompiler: true,
lintOnSave: true,
parallel: true,
integrity: true,
crossorigin: 'anonymous',
publicPath: process.env.NODE_ENV === "production" ? "/vue-app/" : "/",
configureWebpack: {
devServer: {
onBeforeSetupMiddleware: ({ app }) => {
app.use(
"/node_modules/",
express.static(path.resolve(__dirname, "node_modules"))
);
app.use((_, res, next) => {
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
next();
});
},
},
},
pluginOptions: {
compression: {
brotli: {
filename: '[file].br[query]',
algorithm: 'brotliCompress',
include: /\.(js|css|html|svg|json)(\?.*)?$/i,
compressionOptions: {
params: {
[zlib.constants.BROTLI_PARAM_QUALITY]: zlib.constants.BROTLI_MAX_QUALITY,
},
},
minRatio: 0.8,
},
gzip: {
filename: '[file].gz[query]',
algorithm: 'gzip',
include: /\.(js|css|html|svg|json)(\?.*)?$/i,
compressionOptions: { level: zlib.constants.Z_BEST_COMPRESSION },
minRatio: 0.8,
},
},
prettify: false,
},
});