Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 1 | const CompressionPlugin = require('compression-webpack-plugin'); |
Derick Montague | f3ab8bc | 2019-12-10 15:13:25 -0600 | [diff] [blame] | 2 | |
Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 3 | module.exports = { |
| 4 | devServer: { |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 5 | https: true, |
Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 6 | proxy: { |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 7 | '/': { |
Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 8 | target: process.env.BASE_URL, |
| 9 | onProxyRes: proxyRes => { |
Dixsie Wolmers | cbcd213 | 2020-01-30 20:58:37 -0600 | [diff] [blame] | 10 | // This header is ignored in the browser so removing |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 11 | // it so we don't see warnings in the browser console |
| 12 | delete proxyRes.headers['strict-transport-security']; |
Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 13 | } |
| 14 | } |
Derick Montague | f3ab8bc | 2019-12-10 15:13:25 -0600 | [diff] [blame] | 15 | }, |
| 16 | port: 8000 |
| 17 | }, |
| 18 | productionSourceMap: false, |
| 19 | configureWebpack: config => { |
Yoshie Muranaka | 9e36f52 | 2020-02-05 07:42:34 -0800 | [diff] [blame] | 20 | const envName = process.env.VUE_APP_ENV_NAME; |
| 21 | |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 22 | if (process.env.NODE_ENV === 'production') { |
Derick Montague | f3ab8bc | 2019-12-10 15:13:25 -0600 | [diff] [blame] | 23 | config.plugins.push( |
| 24 | new CompressionPlugin({ |
| 25 | deleteOriginalAssets: true |
| 26 | }) |
| 27 | ); |
| 28 | } |
Yoshie Muranaka | 9e36f52 | 2020-02-05 07:42:34 -0800 | [diff] [blame] | 29 | if (envName !== undefined) { |
| 30 | // Resolve store and router modules in src/main.js |
| 31 | // depending on environment (VUE_APP_ENV_NAME) variable |
| 32 | config.resolve.alias['./store$'] = `./env/store/${envName}.js`; |
| 33 | config.resolve.alias['./router$'] = `./env/router/${envName}.js`; |
| 34 | } |
Derick Montague | f3ab8bc | 2019-12-10 15:13:25 -0600 | [diff] [blame] | 35 | }, |
| 36 | chainWebpack: config => { |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 37 | if (process.env.NODE_ENV === 'production') { |
| 38 | config.plugins.delete('prefetch'); |
| 39 | config.plugins.delete('preload'); |
Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 40 | } |
Dixsie Wolmers | cbcd213 | 2020-01-30 20:58:37 -0600 | [diff] [blame] | 41 | }, |
| 42 | pluginOptions: { |
| 43 | i18n: { |
| 44 | localeDir: 'locales', |
| 45 | enableInSFC: true |
| 46 | } |
Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 47 | } |
| 48 | }; |