Deploy customized Node.js module on Heroku

2019-09-21 22:30发布

问题:

I have installed the drupal-node.js module by running npm install command. And then I go inside drupal-node.js in node_modules folder and done place another module inside it.

To run my above Node.js app, I have to go inside node_modules folder and in drupal-node.js and I run node app.js.

Now, I have to deploy my above Node.js app to Heroku. But I think Heroku doesn't allow us to make changes in the node_modules/ folder.

How can I use my local update on Heroku?

回答1:

I can't think of a single situation where you should be directly modifying anything in node_modules/. If you really need to modify a library, submit your change to the library maintainers.

If that's not an option for whatever reason, fork the library and install from your fork using yarn or npm.

Forking a library shouldn't be done lightly. By doing this you're adding a maintenance burden to your project. Now, in addition to your own code, you need to maintain your fork. Pulling updates in from upstream so you can take advantage of bug fixes and security updates is important.