Giter VIP home page Giter VIP logo

Comments (11)

NetanelBasal avatar NetanelBasal commented on May 31, 2024

It's not. I only import the throttle module:

const throttleFn = require('lodash.throttle');

from helpful-decorators.

farfromrefug avatar farfromrefug commented on May 31, 2024

@NetanelBasal yes you do but in index.ts your import all decorators.
Each one importing its lodash counterpart.

So you always end up with up even if you only use one

from helpful-decorators.

NetanelBasal avatar NetanelBasal commented on May 31, 2024

No, Webpack should tree shake the rest.

from helpful-decorators.

farfromrefug avatar farfromrefug commented on May 31, 2024

What do you mean? and it doesn't. I have tested it using webpack report feature

from helpful-decorators.

NetanelBasal avatar NetanelBasal commented on May 31, 2024

You should build in production mode, and Webpack should tree shake what's not in use.

from helpful-decorators.

farfromrefug avatar farfromrefug commented on May 31, 2024

@NetanelBasal thanks for letting me know about tree shaking. I didn't know about it.
Spent a few days making my app work with tree shaking. Now it does. however even if webpack sees that only throttle is used in my project:

[185] ../node_modules/helpful-decorators/dist-web/index.js 4.13 KiB {2} [built]
      [only some exports used: throttle]

the other lodash imports are not removed. Could it be because those are not ECMAScript modules?

[248] ../node_modules/lodash.debounce/index.js 10.5 KiB {2} [built]
      ModuleConcatenation bailout: Module is not an ECMAScript module
[249] ../node_modules/lodash.throttle/index.js 13 KiB {2} [built]
      ModuleConcatenation bailout: Module is not an ECMAScript module
[250] ../node_modules/lodash.once/index.js 6.93 KiB {2} [built]
      ModuleConcatenation bailout: Module is not an ECMAScript module
[251] ../node_modules/lodash.memoize/index.js 16.6 KiB {2} [built]
      ModuleConcatenation bailout: Module is not an ECMAScript modul

from helpful-decorators.

NetanelBasal avatar NetanelBasal commented on May 31, 2024

Weird, because the file itself is. Maybe we should add the sideEffects: false option.

from helpful-decorators.

farfromrefug avatar farfromrefug commented on May 31, 2024

@NetanelBasal what do you mean add it as an option? "sideEffects": false is already in the package.json file of your module

from helpful-decorators.

NetanelBasal avatar NetanelBasal commented on May 31, 2024

Here. https://github.com/NetanelBasal/helpful-decorators/blob/master/package.json

from helpful-decorators.

farfromrefug avatar farfromrefug commented on May 31, 2024

@NetanelBasal it is already there in the published package
Screen Shot 2019-04-10 at 17 48 47

from helpful-decorators.

NetanelBasal avatar NetanelBasal commented on May 31, 2024

Oh missed that.

from helpful-decorators.

Related Issues (12)

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.