xref: /openbmc/webui-vue/vue.config.js (revision 0fc91e79)
1const CompressionPlugin = require('compression-webpack-plugin');
2
3module.exports = {
4  css: {
5    loaderOptions: {
6      scss: {
7        prependData: `
8          @import "@/assets/styles/_obmc-custom.scss";
9        `
10      }
11    }
12  },
13  devServer: {
14    https: true,
15    proxy: {
16      '/': {
17        target: process.env.BASE_URL,
18        onProxyRes: proxyRes => {
19          // This header is igorned in the browser so removing
20          // it so we don't see warnings in the browser console
21          delete proxyRes.headers['strict-transport-security'];
22        }
23      }
24    },
25    port: 8000
26  },
27  productionSourceMap: false,
28  configureWebpack: config => {
29    if (process.env.NODE_ENV === 'production') {
30      config.plugins.push(
31        new CompressionPlugin({
32          deleteOriginalAssets: true
33        })
34      );
35    }
36  },
37  chainWebpack: config => {
38    if (process.env.NODE_ENV === 'production') {
39      config.plugins.delete('prefetch');
40      config.plugins.delete('preload');
41    }
42  }
43};
44