Skip to content

Commit

Permalink
⚡ Reduce js vendor bundle size with better lodash imports (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
kefranabg authored May 5, 2019
1 parent 9abf4a1 commit 4a0ffd8
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"bundlesize": [
{
"path": "./dist/js/chunk-vendors*.js",
"maxSize": "155 kB"
"maxSize": "125 kB"
},
{
"path": "./dist/js/chunk-firestore*.js",
Expand Down
2 changes: 1 addition & 1 deletion src/firebase/authentication.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import firebase from 'firebase/app'
import { isNil } from 'lodash'
import isNil from 'lodash/isNil'

import store from '@/store'

Expand Down
4 changes: 3 additions & 1 deletion src/firebase/generic-db.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { isNil, keys, cloneDeep } from 'lodash'
import isNil from 'lodash/isNil'
import keys from 'lodash/keys'
import cloneDeep from 'lodash/cloneDeep'
import firebase from 'firebase/app'

import firestore from './async-firestore'
Expand Down
2 changes: 1 addition & 1 deletion src/misc/handle-apple-install-prompt.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import store from '@/store'
import { isNil } from 'lodash'
import isNil from 'lodash/isNil'

const isIosOnBrowser =
['iPhone', 'iPad', 'iPod'].includes(navigator.platform) &&
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Router from 'vue-router'
import Head from 'vue-head'
import Home from '@/views/Home'
import CheckLogin from '@/views/CheckLogin'
import { isNil } from 'lodash'
import isNil from 'lodash/isNil'
import store from '@/store'

Vue.use(Router)
Expand Down
2 changes: 1 addition & 1 deletion src/store/app/app.actions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil } from 'lodash'
import isNil from 'lodash/isNil'

export default {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/store/app/app.getters.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil } from 'lodash'
import isNil from 'lodash/isNil'

export default {
newContentAvailable: state => !isNil(state.SWRegistrationForNewContent)
Expand Down
2 changes: 1 addition & 1 deletion src/store/authentication/authentication.actions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import router from '@/router'
import { isNil } from 'lodash'
import isNil from 'lodash/isNil'
import { createNewUserFromFirebaseAuthUser } from '@/misc/helpers'
import UsersDB from '@/firebase/users-db'

Expand Down
2 changes: 1 addition & 1 deletion src/store/authentication/authentication.getters.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil } from 'lodash'
import isNil from 'lodash/isNil'

export default {
isUserLoggedIn: state => !isNil(state.user)
Expand Down
2 changes: 1 addition & 1 deletion src/views/CheckLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<script>
import { mapState } from 'vuex'
import { isNil } from 'lodash'
import isNil from 'lodash/isNil'
export default {
computed: mapState('authentication', ['user']),
Expand Down
2 changes: 1 addition & 1 deletion src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<script>
import { mapState, mapMutations } from 'vuex'
import { isNil } from 'lodash'
import isNil from 'lodash/isNil'
import firebase from 'firebase/app'
import { desktop as isDekstop } from 'is_js'
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/store/products/products.mutations.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mutations from '@/store/products/products.mutations'
import { cloneDeep } from 'lodash'
import cloneDeep from 'lodash/cloneDeep'

const product1 = { id: 1, name: 'product1' }
const product2 = { id: 2, name: 'product2' }
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/views/Login.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vuex from 'vuex'
import { cloneDeep } from 'lodash'
import cloneDeep from 'lodash/cloneDeep'
import { createLocalVue, shallowMount } from '@vue/test-utils'
import LoginView from '@/views/Login.vue'

Expand Down

0 comments on commit 4a0ffd8

Please sign in to comment.