From 3aa54a836ef7f7035bf8b60a208ca093c0987080 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Thu, 6 Jun 2019 22:12:37 +0200
Subject: [PATCH] Reduced page weight

---
 package.json                    |  3 ++-
 src/components/MastodonForm.vue |  2 +-
 src/main.js                     |  1 -
 vue.config.js                   | 15 ++++++++++++---
 yarn.lock                       |  2 +-
 5 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/package.json b/package.json
index 0f84364..38b42a9 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,8 @@
     "dotenv-webpack": "^1.7.0",
     "eslint": "^5.16.0",
     "eslint-plugin-vue": "^5.0.0",
-    "vue-template-compiler": "^2.6.10"
+    "vue-template-compiler": "^2.6.10",
+    "webpack-bundle-analyzer": "^3.3.2"
   },
   "eslintConfig": {
     "root": true,
diff --git a/src/components/MastodonForm.vue b/src/components/MastodonForm.vue
index 5d18d6e..ad011a8 100644
--- a/src/components/MastodonForm.vue
+++ b/src/components/MastodonForm.vue
@@ -3,7 +3,7 @@
   <form @submit.prevent="submit">
     <div class="row">
       <div class="input-field col s12 l6">
-        <input v-model="domain" id="domain" placeholder="mastodon.server" type="text" class="validate">
+        <input v-model="domain" id="domain" placeholder="mastodon.domain" type="text" class="validate">
         <label class="active" for="domain">Mastodon domain</label>
       </div>
     </div>
diff --git a/src/main.js b/src/main.js
index 45e68b6..e07e16d 100644
--- a/src/main.js
+++ b/src/main.js
@@ -4,7 +4,6 @@ import router from './router'
 import store from './store'
 
 import "materialize-css/dist/css/materialize.min.css"
-import "materialize-css/dist/js/materialize.min.js"
 import "material-icons/iconfont/material-icons.css"
 
 Vue.config.productionTip = false
diff --git a/vue.config.js b/vue.config.js
index 2096ab4..6d6bc65 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -1,9 +1,18 @@
 const Dotenv = require('dotenv-webpack');
+const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
+const webpack = require('webpack');
+
+let plugins = [
+  // do not include moment.js locales since it's quite heavy
+  new Dotenv(),
+  new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
+]
+if (process.env.BUNDLE_ANALYZE === '1') {
+  plugins.push(new BundleAnalyzerPlugin())
+}
 
 module.exports = {
   configureWebpack: {
-    plugins: [
-      new Dotenv()
-    ]
+    plugins: plugins
   }
 }
diff --git a/yarn.lock b/yarn.lock
index 5c8b90c..27445b2 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -8338,7 +8338,7 @@ webidl-conversions@^4.0.2:
   resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
   integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==
 
-webpack-bundle-analyzer@^3.3.0:
+webpack-bundle-analyzer@^3.3.0, webpack-bundle-analyzer@^3.3.2:
   version "3.3.2"
   resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-3.3.2.tgz#3da733a900f515914e729fcebcd4c40dde71fc6f"
   integrity sha512-7qvJLPKB4rRWZGjVp5U1KEjwutbDHSKboAl0IfafnrdXMrgC0tOtZbQD6Rw0u4cmpgRN4O02Fc0t8eAT+FgGzA==
-- 
GitLab