R
R
Roman2018-12-24 18:59:01
css
Roman, 2018-12-24 18:59:01

How to globally import individual lodash functions in Vue?

Hello.
There is a project on Vue.js. It uses lodash.
At the moment lodash is connected globally like this:

import _ from 'lodash';    
Object.defineProperty(Vue.prototype, '_', { value: _ });

Now the question arose about optimizing the bundle, in connection with which the question arose - is it possible to globally import only individual functions from lodash? So that in any component I can use, for example, _.get (), without importing separately into each file.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Leonid Fedotov, 2016-03-02
@iLeonidze

About CSS - you are thinking in a very right direction, if I understand your purpose correctly. But you must understand that this is a solid crutch. If you had outlined the problem more specifically, you would have been offered a narrower solution here.
Regarding the load, it will depend on the picture itself. If it's not very big, somewhere up to 4000X4000, then it will be enough, and then hangups can go on, most likely.

A
Anton Anton, 2018-12-24
@Fragster

https://www.npmjs.com/search?q=keywords:lodash-mod...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question