blob: c681f4703764fb3f41dcec4c5aebf69cde04c5a9 [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 = {
4 devServer: {
Yoshie Muranakadc04feb2019-12-04 08:41:22 -08005 https: true,
Yoshie Muranaka6ce1a072019-12-06 14:13:59 -08006 proxy: {
Derick Montaguefded0d12019-12-11 06:16:40 -06007 '/': {
Yoshie Muranaka6ce1a072019-12-06 14:13:59 -08008 target: process.env.BASE_URL,
9 onProxyRes: proxyRes => {
Dixsie Wolmerscbcd2132020-01-30 20:58:37 -060010 // This header is ignored in the browser so removing
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080011 // it so we don't see warnings in the browser console
12 delete proxyRes.headers['strict-transport-security'];
Yoshie Muranaka6ce1a072019-12-06 14:13:59 -080013 }
14 }
Derick Montaguef3ab8bc2019-12-10 15:13:25 -060015 },
16 port: 8000
17 },
18 productionSourceMap: false,
19 configureWebpack: config => {
Yoshie Muranaka9e36f522020-02-05 07:42:34 -080020 const envName = process.env.VUE_APP_ENV_NAME;
21
Derick Montaguefded0d12019-12-11 06:16:40 -060022 if (process.env.NODE_ENV === 'production') {
Derick Montaguef3ab8bc2019-12-10 15:13:25 -060023 config.plugins.push(
24 new CompressionPlugin({
25 deleteOriginalAssets: true
26 })
27 );
28 }
Yoshie Muranaka9e36f522020-02-05 07:42:34 -080029 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 Montaguef3ab8bc2019-12-10 15:13:25 -060035 },
36 chainWebpack: config => {
Derick Montaguefded0d12019-12-11 06:16:40 -060037 if (process.env.NODE_ENV === 'production') {
38 config.plugins.delete('prefetch');
39 config.plugins.delete('preload');
Yoshie Muranaka6ce1a072019-12-06 14:13:59 -080040 }
Dixsie Wolmerscbcd2132020-01-30 20:58:37 -060041 },
42 pluginOptions: {
43 i18n: {
44 localeDir: 'locales',
45 enableInSFC: true
46 }
Yoshie Muranaka74c24f12019-12-03 10:45:46 -080047 }
48};