| 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 | d388a28 | 2020-07-08 16:15:46 -0700 | [diff] [blame^] | 4 | css: { | 
|  | 5 | loaderOptions: { | 
|  | 6 | sass: { | 
|  | 7 | prependData: () => { | 
|  | 8 | const envName = process.env.VUE_APP_ENV_NAME; | 
|  | 9 | if (envName !== undefined) { | 
|  | 10 | // If there is an env name defined, import Sass | 
|  | 11 | // overrides. | 
|  | 12 | // It is important that these imports stay in this | 
|  | 13 | // order to make sure enviroment overrides | 
|  | 14 | // take precedence over the default BMC styles | 
|  | 15 | return ` | 
|  | 16 | @import "@/assets/styles/bmc/helpers"; | 
|  | 17 | @import "@/env/assets/styles/_${process.env.VUE_APP_ENV_NAME}"; | 
|  | 18 | @import "@/assets/styles/bootstrap/_helpers"; | 
|  | 19 | `; | 
|  | 20 | } else { | 
|  | 21 | // Include helper imports so single file components | 
|  | 22 | // do not need to include helper imports | 
|  | 23 |  | 
|  | 24 | // BMC Helpers must be imported before Bootstrap helpers to | 
|  | 25 | // take advantage of Bootstrap's use of the Sass !default | 
|  | 26 | // statement. Moving this helper after results in Bootstrap | 
|  | 27 | // variables taking precedence over BMC's | 
|  | 28 | return ` | 
|  | 29 | @import "@/assets/styles/bmc/helpers"; | 
|  | 30 | @import "@/assets/styles/bootstrap/_helpers"; | 
|  | 31 | `; | 
|  | 32 | } | 
|  | 33 | } | 
|  | 34 | } | 
|  | 35 | } | 
|  | 36 | }, | 
| Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 37 | devServer: { | 
| Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 38 | https: true, | 
| Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 39 | proxy: { | 
| Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 40 | '/': { | 
| Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 41 | target: process.env.BASE_URL, | 
|  | 42 | onProxyRes: proxyRes => { | 
| Dixsie Wolmers | cbcd213 | 2020-01-30 20:58:37 -0600 | [diff] [blame] | 43 | // This header is ignored in the browser so removing | 
| Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 44 | // it so we don't see warnings in the browser console | 
|  | 45 | delete proxyRes.headers['strict-transport-security']; | 
| Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 46 | } | 
|  | 47 | } | 
| Derick Montague | f3ab8bc | 2019-12-10 15:13:25 -0600 | [diff] [blame] | 48 | }, | 
|  | 49 | port: 8000 | 
|  | 50 | }, | 
|  | 51 | productionSourceMap: false, | 
|  | 52 | configureWebpack: config => { | 
| Yoshie Muranaka | 9e36f52 | 2020-02-05 07:42:34 -0800 | [diff] [blame] | 53 | const envName = process.env.VUE_APP_ENV_NAME; | 
|  | 54 |  | 
| Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 55 | if (process.env.NODE_ENV === 'production') { | 
| Derick Montague | f3ab8bc | 2019-12-10 15:13:25 -0600 | [diff] [blame] | 56 | config.plugins.push( | 
|  | 57 | new CompressionPlugin({ | 
|  | 58 | deleteOriginalAssets: true | 
|  | 59 | }) | 
|  | 60 | ); | 
|  | 61 | } | 
| Yoshie Muranaka | 9e36f52 | 2020-02-05 07:42:34 -0800 | [diff] [blame] | 62 | if (envName !== undefined) { | 
|  | 63 | // Resolve store and router modules in src/main.js | 
|  | 64 | // depending on environment (VUE_APP_ENV_NAME) variable | 
|  | 65 | config.resolve.alias['./store$'] = `./env/store/${envName}.js`; | 
|  | 66 | config.resolve.alias['./router$'] = `./env/router/${envName}.js`; | 
|  | 67 | } | 
| Derick Montague | f3ab8bc | 2019-12-10 15:13:25 -0600 | [diff] [blame] | 68 | }, | 
|  | 69 | chainWebpack: config => { | 
| Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 70 | if (process.env.NODE_ENV === 'production') { | 
|  | 71 | config.plugins.delete('prefetch'); | 
|  | 72 | config.plugins.delete('preload'); | 
| Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 73 | } | 
| Dixsie Wolmers | cbcd213 | 2020-01-30 20:58:37 -0600 | [diff] [blame] | 74 | }, | 
|  | 75 | pluginOptions: { | 
|  | 76 | i18n: { | 
|  | 77 | localeDir: 'locales', | 
|  | 78 | enableInSFC: true | 
|  | 79 | } | 
| Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 80 | } | 
|  | 81 | }; |