Use specific methods from lodash to reduce bundle size

This commit is contained in:
Eliot Berriot 2018-12-20 11:21:15 +01:00
parent 17d86a2832
commit b2acd1e8a8
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
25 changed files with 38 additions and 24 deletions

View File

@ -52,7 +52,7 @@
<script>
import axios from 'axios'
import _ from 'lodash'
import _ from '@/lodash'
import {mapState} from 'vuex'
import { WebSocketBridge } from 'django-channels'
import GlobalEvents from '@/components/utils/global-events'

View File

@ -24,7 +24,7 @@
</template>
<script>
import _ from "lodash"
import _ from "@/lodash"
export default {
props: {

View File

@ -29,7 +29,7 @@
</template>
<script>
import _ from 'lodash'
import _ from '@/lodash'
import axios from 'axios'
import logger from '@/logging'
import AlbumCard from '@/components/audio/album/Card'

View File

@ -4,7 +4,7 @@
<script>
import {mapState} from 'vuex'
import _ from 'lodash'
import _ from '@/lodash'
import url from '@/utils/url'
import {Howl} from 'howler'

View File

@ -36,7 +36,7 @@
</template>
<script>
import _ from 'lodash'
import _ from '@/lodash'
import axios from 'axios'
import PlayButton from '@/components/audio/PlayButton'

View File

@ -47,7 +47,7 @@
</template>
<script>
import _ from 'lodash'
import _ from '@/lodash'
import axios from 'axios'
import PlayButton from '@/components/audio/PlayButton'
@ -109,7 +109,7 @@ export default {
</script>
<style scoped lang="scss">
@import '../../../style/vendor/media';
@import "../../../style/vendor/media";
.play-overlay {
position: absolute;

View File

@ -26,7 +26,7 @@
</template>
<script>
import _ from 'lodash'
import _ from '@/lodash'
import axios from 'axios'
import LibraryCard from '@/views/content/remote/Card'

View File

@ -61,7 +61,7 @@
</template>
<script>
import _ from 'lodash'
import _ from '@/lodash'
import axios from 'axios'
import logger from '@/logging'

View File

@ -69,7 +69,7 @@
</template>
<script>
import _ from "lodash"
import _ from "@/lodash"
import axios from "axios"
import logger from "@/logging"
import backend from "@/audio/backend"

View File

@ -70,7 +70,7 @@
<script>
import axios from "axios"
import _ from "lodash"
import _ from "@/lodash"
import $ from "jquery"
import logger from "@/logging"

View File

@ -123,6 +123,7 @@
</template>
<script>
import _ from "@/lodash"
import $ from "jquery";
import axios from "axios";
import logger from "@/logging";

View File

@ -92,7 +92,7 @@
<script>
import axios from "axios"
import _ from "lodash"
import _ from "@/lodash"
import $ from "jquery"
import logger from "@/logging"

View File

@ -94,7 +94,7 @@
<script>
import axios from "axios"
import $ from "jquery"
import _ from "lodash"
import _ from "@/lodash"
import BuilderFilter from "./Filter"
import TrackTable from "@/components/audio/track/Table"
import RadioButton from "@/components/radios/Button"

View File

@ -64,7 +64,7 @@
<script>
import axios from 'axios'
import $ from 'jquery'
import _ from 'lodash'
import _ from '@/lodash'
import Modal from '@/components/semantic/Modal'
import TrackTable from '@/components/audio/track/Table'

View File

@ -106,7 +106,7 @@
<script>
import axios from 'axios'
import _ from 'lodash'
import _ from '@/lodash'
import time from '@/utils/time'
import Pagination from '@/components/Pagination'
import ActionTable from '@/components/common/ActionTable'

View File

@ -86,7 +86,7 @@
<script>
import axios from 'axios'
import moment from 'moment'
import _ from 'lodash'
import _ from '@/lodash'
import Pagination from '@/components/Pagination'
import ActionTable from '@/components/common/ActionTable'
import OrderingMixin from '@/components/mixins/Ordering'

View File

@ -96,7 +96,7 @@
<script>
import axios from 'axios'
import _ from 'lodash'
import _ from '@/lodash'
import time from '@/utils/time'
import Pagination from '@/components/Pagination'
import ActionTable from '@/components/common/ActionTable'

View File

@ -67,7 +67,7 @@
</template>
<script>
import _ from 'lodash'
import _ from '@/lodash'
import axios from 'axios'
import {mapState} from 'vuex'

View File

@ -15,7 +15,7 @@
</template>
<script>
import _ from 'lodash'
import _ from '@/lodash'
import axios from 'axios'
import PlaylistCard from '@/components/playlists/Card'

13
front/src/lodash.js Normal file
View File

@ -0,0 +1,13 @@
// cherry-pick specific lodash methods here to reduce bundle size
export default {
clone: require('lodash/clone'),
debounce: require('lodash/debounce'),
get: require('lodash/get'),
merge: require('lodash/merge'),
range: require('lodash/range'),
shuffle: require('lodash/shuffle'),
sortBy: require('lodash/sortBy'),
throttle: require('lodash/throttle'),
uniq: require('lodash/uniq'),
}

View File

@ -1,6 +1,6 @@
import axios from 'axios'
import logger from '@/logging'
import _ from 'lodash'
import _ from '@/lodash'
function getDefaultUrl () {
return (

View File

@ -1,5 +1,5 @@
import logger from '@/logging'
import _ from 'lodash'
import _ from '@/lodash'
export default {
namespaced: true,

View File

@ -120,7 +120,7 @@
<script>
import axios from 'axios'
import _ from 'lodash'
import _ from '@/lodash'
import time from '@/utils/time'
import {normalizeQuery, parseTokens, compileTokens} from '@/search'

View File

@ -56,7 +56,7 @@
<script>
import axios from "axios"
import _ from "lodash"
import _ from "@/lodash"
import $ from "jquery"
import OrderingMixin from "@/components/mixins/Ordering"

View File

@ -1,7 +1,7 @@
var sinon = require('sinon')
import {expect} from 'chai'
import _ from 'lodash'
import _ from '@/lodash'
import store from '@/store/queue'
import { testAction } from '../../utils'