-
Notifications
You must be signed in to change notification settings - Fork 25
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
Support applications installed with npm 3+ #145
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdebost
force-pushed
the
feature/npm3
branch
5 times, most recently
from
January 31, 2019 20:43
be15f63
to
7f91b86
Compare
Open
If bluebird can't be loaded from the app package, it will be retried under mr (npm 2 / legacy bundling support).
marchant
reviewed
Aug 9, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, I tested with multiple applications and through an additional pull request depending on this.
I believe I independently fixed the exception happening in the mop integration in a PR that depends on this. Merging. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a partial application of #117 including only the changes relevant to npm 3+ support. #117 and its sister PRs in montage and mop introduced too many changes to review all at once.
This PR introduces no breaking changes for montage#master, aside from the non-harmful warnings (see "Impact").
Background
In npm 3+, dependencies will be installed as close to the root as possible without causing version conflicts, meaning a module may find its dependency under its own
node_modules
, or the parent'snode_modules
, or the grandparent'snode_modules
, etc. This is different from npm 2 where dependencies-of-dependencies are always installed under the package's ownnode_modules
.The fix to support npm 3+ is two-fold:
package-lock.json
file is generated, which encodes the exact structure ofnode_modules
. When un-mopped,mr
will attempt to load apackage-lock.json
file under the application root and use it to resolve dependencies.package-lock.json
is available, dependencies will be retried on all parent directories'node_modules
.Impact
When running mopped apps, nothing will change regardless of the
node
/npm
version.When running un-mopped:
npm 2
(node 4
): Non-harmful 404 errors will appear in the browser console asmr
retriesbluebird
.npm 3
(node 6
), ornpm 5+
andpackage-lock
disabled: The app will load, but the browser console will fill up with non-harmful404
errors asmr
retries dependencies at different locations.npm 5+
(node 8+
): The app will run normally, with no new404
errors in the browser.