New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make bundles smaller by deduping dependencies #5739
Comments
Ready for AT on |
I've merged this into |
I have another branch with a different and, hopefully, more stable approach: |
@dianabarsan I am unable to build because of the following: Running "browserify:webapp" (browserify) task
>> Error: Cannot find module '/projects/medic-webapp/webapp/node_modules/@medic/phone-number' from '/projects/medic-webapp' |
@wtekeu |
@dianabarsan |
@wtekeu
If you run |
@dianabarsan the command >> added 317 packages in 8.582s
>> ln: illegal option -- r
>> usage: ln [-Ffhinsv] source_file [target_file]
>> ln [-Ffhinsv] source_file ... target_dir
>> link source_file target_file
>> Exited with code: 1.
>> Error executing child process: Error: Process exited with code 1.
Warning: Task "exec:npm-ci-modules" failed. Use --force to continue. |
Ok, I'll look into it. |
@wtekeu I changed the options on |
@dianabarsan Now it is build ( Running "exec:pack-node-modules" (exec) task
>> npm
>> WARN prepare removing existing node_modules/ before installation
>> added 219 packages in 2.699s
>> npm ERR!
>> path /Users/wtekeu/projects/codes/medic-webapp/api/node_modules/@medic/transitions/node_modules/.bin/mustache
>> npm
>>
>> ERR! code EEXIST
>> npm
>> ERR! Refusing to delete /Users/wtekeu/projects/codes/medic-webapp/api/node_modules/@medic/transitions/node_modules/.bin/mustache: is outside /Users/wtekeu/projects/codes/medic-webapp/api/node_modules/@medic/transitions/node_modules/mustache and not a link
>> npm
>> ERR! File exists: /Users/wtekeu/projects/codes/medic-webapp/api/node_modules/@medic/transitions/node_modules/.bin/mustache
>> npm
>> ERR! Move it away, and try again.
>>
>> npm ERR! A complete log of this run can be found in:
>> npm ERR! /Users/wtekeu/.npm/_logs/2019-07-02T17_52_06_993Z-debug.log
>> Exited with code: 1.
>> Error executing child process: Error: Process exited with code 1. I have tried running npm ERR! path /Users/wtekeu/projects/codes/medic-webapp/api/node_modules/@medic/transitions/node_modules/.bin/mustache
npm ERR! code EEXIST
npm ERR! Refusing to delete /Users/wtekeu/projects/codes/medic-webapp/api/node_modules/@medic/transitions/node_modules/.bin/mustache: is outside /Users/wtekeu/projects/codes/medic-webapp/api/node_modules/@medic/transitions/node_modules/mustache and not a link
npm ERR! File exists: /Users/wtekeu/projects/codes/medic-webapp/api/node_modules/@medic/transitions/node_modules/.bin/mustache
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/wtekeu/.npm/_logs/2019-07-02T17_53_54_930Z-debug.log I have tried deleting |
Which command are you running? again |
|
Which npm version are you using? |
|
Pff thanks. I did try it with this version locally and didn't have this issue, might be some peculiarity. I'll give it another try tomorrow and reach out if I can't replicate. |
I ran |
LGTM. Ready for release. @dianabarsan will merge. 3.4.x -rw-r--r-- 1 wtekeu staff 3.8M Jul 3 09:35 medic-api-0.1.0.tgz
-rw-r--r-- 1 wtekeu staff 3.0M Jul 3 09:35 medic-sentinel-0.1.0.tgz
-rw-r--r-- 1 wtekeu staff 19M Jul 3 09:36 compiled.json
-rw-r--r-- 1 wtekeu staff 3.8M Jul 3 09:24 medic-api-0.1.0.tgz
-rw-r--r-- 1 wtekeu staff 2.9M Jul 3 09:24 medic-sentinel-0.1.0.tgz
-rw-r--r-- 1 wtekeu staff 19M Jul 3 09:24 compiled.json |
An alternative to depending on npm to correctly map local scoped dependencies. We do not add our shared libraries as dependencies in our package.json files any more. For development, the libs are symlinked into node_modules by grunt - like npm ci would do. For creating packages, both api and sentinel have a new property in their package.json that should list the shared-libs that the module uses and must be bundled. #5739
Post #5694 (which made our shared-libs local again), our
api
andsentinel
bundles doubled in size because of lots of duplicated dependencies (npm pack
straight up copies the symlinked folders ).Running
npm dedupe
reduces our bundle sizes to what they were before.The text was updated successfully, but these errors were encountered: