remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development

Home Page:http://nodemon.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

if no file is specified use package.json's main property

dylang opened this issue · comments

A simple short for lazy developers - if no command line arguments and package.json exist then use the main property.

EDIT: was use index.js

or check for a package.json file in the directory and use it's main entry.

I like that even better. Updating description...

On it.

Why reopened? This change was applied in the last change to nodemon and released to npm...

i reopened because i didn't see the change in the changelist associated with this but i must have done something wrong because my comment wasn't included and the feature works now.

thanks a ton for adding it!

The change was here if you're interested: 88269ba#L1R129

<3 <3 <3 <3

this doesn't work for me, main is not intended to start the app, it would be nicer if we looked for a npm start (ie. scripts.start in package.json), and run that command as using npm --exec

Makes no sense, this is ridiculous. Using "main" violates the principle of least astonishment. Node CLI DOES NOT uses "main" for starting the server, that's used for import clients not server start clients.

I'm using the same project as a import to other bounded contexts to be able to execute code owned by one domain boundary and the server startup that uses npm run dev to start a specific server file using nodemon start-server. My npm start uses node start-server which works.

How do I prevent this completely unexpected and erroneous behaviour? Any workaround?

Please guys, avoid trying to do magic, I beg you. Nodemon is a great tool don't destroy it. I can open a PR reverting this if you want.

This needs urgent reopening. Sorry if my tone sounds too demanding, just to express the frustration, I hope you don't take personally.

Great work with nodemon!

EDIT: solution was to use node --watch-path=./src start-server in NodeJS v18[1]. No workaround found.

1: https://nodejs.org/api/cli.html#--watch-path