EddyVerbruggen / nativescript-nodeify

Makes most npm packages compatible with NativeScript
MIT License
93 stars 27 forks source link

To patch the node_modules in platforms folder using after_prepare hook #31

Closed CharlesJu1 closed 6 years ago

CharlesJu1 commented 6 years ago

I gave it a try to make the plugin patch the node_modules in the platforms folder rather than the source folder. It seems working ok. Here is what I did:

In package.json, change the before_prepare hook to after_prepare hook and points to a new script file called patch_platform.js In patch_platform.js, require the platform specific patch-npm-packages.js. In patch-npm-packages.js, on line 227, require the package.json file from the source dir. The code logic is the same as before.

EddyVerbruggen commented 6 years ago

Hi @CharlesJu1, I've tested your changes and AFAIK they are rock-solid! The embedded demo app doesn't contain a lot of test-packages, but at least those that I can check work just fine.

Thanks for your efforts! I'm publishing 0.6.0 now.

EddyVerbruggen commented 6 years ago

I wonder if this change affects Webpack-builds by the way. I guess we'll learn soon.

westlakem commented 6 years ago

As a bonus, this PR seemed to drastically reduce build time (from 10-12 minutes to 2 on our app)

EddyVerbruggen commented 6 years ago

@westlakem It sure does, because fi dev-dependencies and platform-specific files of irrelevant platforms are no longer parsed 🚀.