#Hook in to "next dev" command

12 messages · Page 1 of 1 (latest)

solar karma
#

I would like to make a third party library that users can install along with Next. It will need to watch for file changes in the users code and perform actions in response.

Obviously I can instruct the user to update their dev command to something like next dev && npx my-library but would greatly prefer a solution that starts up automatically (and without configuration) along with next dev

Note: In prod this will not be necessary, as the user's code will be known ahead of time, so it can just be done once before / during build

hardy spearBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

wise nymph
solar karma
#

oh wow, this is perfect, thank you! so if i'm understanding this correctly, there probably is not a way to do this silently, with zero user configuration?

eg: user installs dependency, dependency configures itself to start with next

would probably be a security issue anyway i guess

wise nymph
#

yeah need user intervention

#

you notice many things require users to withSomething(config), this is why

solar karma
#

yep, for sure, makes sense. i'm sure it could also potentially cause really insidious bugs, some dep is causing performance issues or something, but user has no idea why

#

(if they allowed the dep to configure itself, i mean)

wise nymph
#

yeah

#

technically you can use postinstall scripts to auto-configure for users

#

i wouldn't recommend that though, unnecessarily complex

#

not to mention some package managers block postinstall by default