-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix/Support npm file references #281
Conversation
@HyperBrain Unfortunately, I still had not seen this PR so I ended up implementing my own solution. It's 100% working for my project. Now that I realized this PR already existed we could put efforts in this PR or maybe follow with my approach. What do you think @HyperBrain? |
@franciscocpg Yes, see #263 where I documented the npm bug. I created that when I ran into the issue, but until now nothing happened there. The reason why it does not work is exactly the wrong handling of npm, because it does not check changes in the package.json files but only uses package-lock in the case of file: references. |
Just had a look at your solution. Although it works, the only publicly documented and accessible file that npm gives us is the package.json. |
I see. But I think that while npm/npm#19183 isn't fixed the only way to get this relative modules working is modifying As a workaround, maybe we should use the approach you are using in this PR and to do the same What do you think @HyperBrain ? |
Sounds like a good idea. Just let's additionally add the rebased paths to the lock file. Then it should be quite stable. |
ok, leave it with me. |
* Rebase package-lock * Fix rebasePackageLock call * Adding tests for package-lock file rewrite * Fix comment
@franciscocpg I'm doing some tests with a bigger project right now. If it correctly packages the local modules now, I will merge it. 4.2.0 will be released soon (in case we do not have any other issues fixed). Thanks for the help on this and the great speedup of the feature 😃 |
Did some tests. On Linux (Ubuntu) everything worked as expected, on Windows I got some link EPERM errors when npm tries to create its symlink, but that is expected, because "npm install <file ref>" and "npm link <fileref>" lead to the same errors locally. It seems my filesystem rights are screwed somewhere. |
I have a VMWare OSX box in my personal laptop. I can try it later. |
Hi, Just tested this on OSX and it appears to be picking up the file referenced dependencies correctly. |
Thank you @chronotc. Did you test with and without |
@franciscocpg Tried the same thing with Thanks for the help guys 👍 as the lack fo file referenced dependency support prevented us from adopting serverless-webpack. |
@HyperBrain |
Will do soon 😀
Francisco Guimarães <notifications@github.com> schrieb am Mi., 20. Dez.
2017, 11:45 nachm.:
… @HyperBrain <https://github.com/hyperbrain>
IMO it's ready to be merged.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#281 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFRM3l21CTl4znV0B_0ZLIgpML_LUiRyks5tCY4IgaJpZM4Qh7rz>
.
|
Will release 4.2.0 with this fix now, as other features/fixes are not yet ready. |
…pm-file-references Fix/Support npm file references
What did you implement:
Closes #263
How did you implement it:
Local module reference paths are now rebased to the package directories where the package.json is, that is used to install the dependency. This will let npm find the local module (what was the actual error) and package it correctly.
How can we verify it:
Use a
file:
reference in the dependencies and do aserverless package
. The command should succeed and the local module should exist in the packaged ZIP's node_modules folder.Todos:
Is this ready for review?: YES
Is it a breaking change?: NO