xref: /openbmc/webui-vue/vue.config.js (revision cbcd2136)
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 ignored 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  pluginOptions: {
44    i18n: {
45      localeDir: 'locales',
46      enableInSFC: true
47    }
48  }
49};
50