Git Product home page Git Product logo

Comments (4)

DrewML avatar DrewML commented on May 28, 2024

@codyhatch Looking at 75265ac, that fix only addresses removal of optionalDependencies that are specified in the top-level package.json for your project - it does not look to handle the optionalDependencies specified by your transitive deps.

As a work-around for the time being, you can add fsevents to the optionalDependencies in the package.json for your application.

I think the correct fix here would be to prune optional dependencies that exist anywhere in the tree, as @palmerj3 pointed out in #74.

@JamieMason thoughts?

from shrinkpack.

JamieMason avatar JamieMason commented on May 28, 2024

Agree @DrewML that you'd have to pluck optionalDependencies from every package.json in the dependency graph to then prune it from the shrinkwrap.

I'll think about this some more, but I'm initially hesitant because I'm already not content with how much shrinkpack has needed to be a bag of patches for upsteam npm shrinkwrap issues. That said, npm shrinkwrap is shrinkpack's source of data, so it's pretty difficult to avoid.

from shrinkpack.

JamieMason avatar JamieMason commented on May 28, 2024

I'll close #74 as a duplicate as there is more discussion in this thread.

According to NPM if you remove optionalDependencies in npm-shrinkwrap.json but they still exist in package.json NPM will install them anyways. I totally disagree with this behavior and will be working on a NPM PR to remove this behavior entirely. But I think you could handle this in shrinkpack.

Certainly removing optionalDeps from top level package.json would be doable but it's not clear to me right now if you will also need to handle this for lower level packages.
@palmerj3

from shrinkpack.

JamieMason avatar JamieMason commented on May 28, 2024

I've pushed a change to feat/75-nested-optional-deps which seems to work well, using the "optional": true properties found in shrinkwraps generated by newer versions of npm.

The test suite will need updating before it can be released though, as the pruning of optional dependencies results in different files in node_modules (the default behaviour when doing an npm install normally is to include optional dependencies).

from shrinkpack.

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.