Giter Site home page Giter Site logo

Comments (14)

axelson avatar axelson commented on August 20, 2024 7

+1 to this so that I don't need an extra copy of lodash in my distributed bundle

from velocity-react.

fionawhim avatar fionawhim commented on August 20, 2024 2

from velocity-react.

fionawhim avatar fionawhim commented on August 20, 2024 1

Presumably we could upgrade to 4, though I don't see why you'd be getting an error now. In my tests, NPM installed lodash 3.10 into velocity-react's node_modules folder.

You may need to wipe your node_modules directory and do a re-install to get that, though.

from velocity-react.

BLMaster avatar BLMaster commented on August 20, 2024 1

Yeah you're right..
I got the error when upgraded the package.
Reinstalling velocity-react will solve it..

Thanks!

from velocity-react.

fionawhim avatar fionawhim commented on August 20, 2024

Not sure what the error is… we're pegged to the 3.10 implementation.

from velocity-react.

TCMiranda avatar TCMiranda commented on August 20, 2024

It seems that the only problem is the "namespace" isn't it?
From: lodash/lang/isEqual
To: lodash/isEqual

Pluck has been deprecated also, will it be hard to upgrade?

from velocity-react.

luisherranz avatar luisherranz commented on August 20, 2024

+1 to this so that I don't need an extra copy of lodash in my distributed bundle

True!

from velocity-react.

fionawhim avatar fionawhim commented on August 20, 2024

Note that velocity-react doesn't require all of lodash, just a handful of functions. So, you're not getting a full extra copy in your bundle.

from velocity-react.

eddiemonge avatar eddiemonge commented on August 20, 2024

Then why not only require the lodash packages you are using?

from velocity-react.

fionawhim avatar fionawhim commented on August 20, 2024

from velocity-react.

eddiemonge avatar eddiemonge commented on August 20, 2024

Not really. All of lodash is still included. This only installs the ones that are actually used: #219

from velocity-react.

fionawhim avatar fionawhim commented on August 20, 2024

from velocity-react.

eddiemonge avatar eddiemonge commented on August 20, 2024

It gains not having to install all of lodash since its a dependency and gets installed when this does. Its not only about the production environment but also dev. Faster installs, less file size overhead. Why not be explicit?

from velocity-react.

SterlingVix avatar SterlingVix commented on August 20, 2024

@finneganh -- I'm also having this Lodash issue, though I'm not 100% confident that it's velocity-react (50/50 chance at this point). But regarding the explicit imports in Lodash and webpack only requiring the necessary modules -- I don't think you get that for free with Webpack.

My understanding is that if you were to import all of your lodash statements namespaced, i.e.:

import { merge } from 'lodash';

... then Webpack would, as part of optimizing the dependency graph, only create a module out of merge.

But if you import all of lodash, i.e.:

import _ from 'lodash';

... then you've got all of lodash coming your way.

You can validate the weight of lodash in velocity-react using the bundle-analyzer-tool:

https://github.com/th0r/webpack-bundle-analyzer

To get Webpack to optimize your lodash build, you need to run a Babel transform:

https://www.npmjs.com/package/babel-plugin-lodash

from velocity-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.