Concurrent task alongside 'ntl dev'

Is there a way to have a task run together with the dev command whenever I type ntl dev? The case I have is that I want to make my functions in dev accessible from outside (Sanity CMS in this case). For this I’m using localtunnel which I can invoke on default port 8888 by running: lt --port 8888 --subdomain <my-fixed-subdomain>.

I don’t want to run this command separately however every time I run ntl dev. I tried adding concurrently inside the dev npm script part of my package.json as per below. This doesn’t work unfortunately. The outside tunnel is established but the ntl-ci dev server then never starts.

scripts: {
  dev: "concurrently \"lt --port 8888 -- subdomain <my-fixed-subdomain>\""

I’m aware that netlify cli can be started in a live session, but this doesn’t provide me with a fixed subdomain so I constantly need to update the webhook address inside the Sanity CMS admin interface.

Hey @mdings :wave:t2:

You can do this with the & operator in unix-based shells:

ntl dev & lt --port 8888 ..etc

Just give it a second to boot both processes and you should be alright.

Hope that helps!


  • though I should mention that using the & is just short-hand for “kick off this first process in the background then start the next one” - so you really are using two process threads here, and whenever you kill the one running in the foreground (the lt command, in this case), you’ll need to run the command fg to bring the background process (ntl dev in this case) up to the foreground, then hit Ctrl+C to kill that one too :slight_smile:

NO WAY! Is it really that easy? Haha, awesome! Thanks for the solution @jonsully :pray: