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 = { |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 4 | css: { |
| 5 | loaderOptions: { |
| 6 | scss: { |
| 7 | prependData: ` |
| 8 | @import "@/assets/styles/_obmc-custom.scss"; |
| 9 | ` |
| 10 | } |
| 11 | } |
| 12 | }, |
Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 13 | devServer: { |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 14 | https: true, |
Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 15 | proxy: { |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 16 | '/': { |
Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 17 | target: process.env.BASE_URL, |
| 18 | onProxyRes: proxyRes => { |
Dixsie Wolmers | cbcd213 | 2020-01-30 20:58:37 -0600 | [diff] [blame] | 19 | // This header is ignored in the browser so removing |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 20 | // it so we don't see warnings in the browser console |
| 21 | delete proxyRes.headers['strict-transport-security']; |
Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 22 | } |
| 23 | } |
Derick Montague | f3ab8bc | 2019-12-10 15:13:25 -0600 | [diff] [blame] | 24 | }, |
| 25 | port: 8000 |
| 26 | }, |
| 27 | productionSourceMap: false, |
| 28 | configureWebpack: config => { |
Yoshie Muranaka | 9e36f52 | 2020-02-05 07:42:34 -0800 | [diff] [blame] | 29 | const envName = process.env.VUE_APP_ENV_NAME; |
| 30 | |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 31 | if (process.env.NODE_ENV === 'production') { |
Derick Montague | f3ab8bc | 2019-12-10 15:13:25 -0600 | [diff] [blame] | 32 | config.plugins.push( |
| 33 | new CompressionPlugin({ |
| 34 | deleteOriginalAssets: true |
| 35 | }) |
| 36 | ); |
| 37 | } |
Yoshie Muranaka | 9e36f52 | 2020-02-05 07:42:34 -0800 | [diff] [blame] | 38 | 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 Montague | f3ab8bc | 2019-12-10 15:13:25 -0600 | [diff] [blame] | 44 | }, |
| 45 | chainWebpack: config => { |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 46 | if (process.env.NODE_ENV === 'production') { |
| 47 | config.plugins.delete('prefetch'); |
| 48 | config.plugins.delete('preload'); |
Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 49 | } |
Dixsie Wolmers | cbcd213 | 2020-01-30 20:58:37 -0600 | [diff] [blame] | 50 | }, |
| 51 | pluginOptions: { |
| 52 | i18n: { |
| 53 | localeDir: 'locales', |
| 54 | enableInSFC: true |
| 55 | } |
Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 56 | } |
| 57 | }; |