Coder Social home page Coder Social logo

Comments (7)

h0ru5 avatar h0ru5 commented on July 20, 2024

Can confirm yarn works fine with this, problem is: some scripts call npm explicitly

from node-wot.

wiresio avatar wiresio commented on July 20, 2024

I tried:

  • yarn init
  • yarn add [packages]
  • npm run build
  • lerna exec 'npm prune --production'
    and checked functionality by running the counter.js example - which worked. The size of compiled node-wot w/ all packages was reduced from 786 MByte down to 182 MByte.
    A TODO would now be to add a respective rule to package.json.

from node-wot.

h0ru5 avatar h0ru5 commented on July 20, 2024

@wiresio not necessary.
you can also just reuse the existing package.json (and npm lockfiles to be correct).
just remove the existing node_modules and run yarn (== npm install) and you will have the modules.

Also instead of running npm run build you can run yarn build (works for all scripts in package.json)

downside of yarn is, its one more step to install and document and AFAIK there is no equivalent for npx (running locally installed tools from ./node_modules/.bin/)

I am not sure how lerna does work with yarn however...

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

Mhh, I tried the following

  1. removed all node_modules folders etc
  2. Installed yarn
  3. run yarn
  4. run yarn build

and I was back at 700MB :-(

from node-wot.

wiresio avatar wiresio commented on July 20, 2024

This is also my experience. That's why 'pruning' is necessary to reduce the size. When you prune without having run yarn before, node-wot will not work.

from node-wot.

h0ru5 avatar h0ru5 commented on July 20, 2024

ahh, ok.
I guess that's b/c of prod vs. dev.
https://yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-production-true-false

try yarn --production instead or set env variable NODE_ENV=production (probably only latter one will work with lerna)

above, you install devDeps with yarn, then prune them away with npm, leaving only prod.

the same is for npm by the way: https://docs.npmjs.com/cli/install

from node-wot.

h0ru5 avatar h0ru5 commented on July 20, 2024

Ok, seems installing & pruning is the right way here, because lerna has an issue regarding production flags:
lerna/lerna#721

from node-wot.

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.