forked from weareopensource/Vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
45 lines (43 loc) · 1.2 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
const { defineConfig } = require('@vue/cli-service');
const CompressionPlugin = require('compression-webpack-plugin');
const config = require('./src/config/index.cjs');
module.exports = defineConfig({
transpileDependencies: true,
runtimeCompiler: true,
configureWebpack: {
plugins: [
new CompressionPlugin({
filename: '[path][base].br',
algorithm: 'brotliCompress',
test: /\.js$/,
}),
],
},
devServer: {
// proxy: 'http://localhost:3000/',
port: config.port,
setupMiddlewares(middlewares, devServer) {
if (!devServer) {
throw new Error('webpack-dev-server is not defined');
}
middlewares.unshift({
name: 'serve-brotli-js',
path: '*.js',
middleware: (req, res, next) => {
if (req.get('Accept-Encoding')?.includes('br')) {
req.url += '.br';
res.set('Content-Encoding', 'br');
res.set('Content-Type', 'application/javascript; charset=utf-8');
}
next();
},
});
return middlewares;
},
},
pluginOptions: {
vuetify: {
// https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vuetify-loader
},
},
});