blob: 882944fab41ebc52692852f565c1e1ec966b76f5 [file] [log] [blame]
Derick Montaguefded0d12019-12-11 06:16:40 -06001const CompressionPlugin = require('compression-webpack-plugin');
Derick Montaguef3ab8bc2019-12-10 15:13:25 -06002
Yoshie Muranaka74c24f12019-12-03 10:45:46 -08003module.exports = {
Yoshie Muranakadc04feb2019-12-04 08:41:22 -08004 css: {
5 loaderOptions: {
6 scss: {
7 prependData: `
8 @import "@/assets/styles/_obmc-custom.scss";
9 `
10 }
11 }
12 },
Yoshie Muranaka74c24f12019-12-03 10:45:46 -080013 devServer: {
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080014 https: true,
Yoshie Muranaka6ce1a072019-12-06 14:13:59 -080015 proxy: {
Derick Montaguefded0d12019-12-11 06:16:40 -060016 '/': {
Yoshie Muranaka6ce1a072019-12-06 14:13:59 -080017 target: process.env.BASE_URL,
18 onProxyRes: proxyRes => {
Dixsie Wolmerscbcd2132020-01-30 20:58:37 -060019 // This header is ignored in the browser so removing
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080020 // it so we don't see warnings in the browser console
21 delete proxyRes.headers['strict-transport-security'];
Yoshie Muranaka6ce1a072019-12-06 14:13:59 -080022 }
23 }
Derick Montaguef3ab8bc2019-12-10 15:13:25 -060024 },
25 port: 8000
26 },
27 productionSourceMap: false,
28 configureWebpack: config => {
Yoshie Muranaka9e36f522020-02-05 07:42:34 -080029 const envName = process.env.VUE_APP_ENV_NAME;
30
Derick Montaguefded0d12019-12-11 06:16:40 -060031 if (process.env.NODE_ENV === 'production') {
Derick Montaguef3ab8bc2019-12-10 15:13:25 -060032 config.plugins.push(
33 new CompressionPlugin({
34 deleteOriginalAssets: true
35 })
36 );
37 }
Yoshie Muranaka9e36f522020-02-05 07:42:34 -080038 if (envName !== undefined) {
39 // Resolve store and router modules in src/main.js
40 // depending on environment (VUE_APP_ENV_NAME) variable
41 config.resolve.alias['./store$'] = `./env/store/${envName}.js`;
42 config.resolve.alias['./router$'] = `./env/router/${envName}.js`;
43 }
Derick Montaguef3ab8bc2019-12-10 15:13:25 -060044 },
45 chainWebpack: config => {
Derick Montaguefded0d12019-12-11 06:16:40 -060046 if (process.env.NODE_ENV === 'production') {
47 config.plugins.delete('prefetch');
48 config.plugins.delete('preload');
Yoshie Muranaka6ce1a072019-12-06 14:13:59 -080049 }
Dixsie Wolmerscbcd2132020-01-30 20:58:37 -060050 },
51 pluginOptions: {
52 i18n: {
53 localeDir: 'locales',
54 enableInSFC: true
55 }
Yoshie Muranaka74c24f12019-12-03 10:45:46 -080056 }
57};