Static GitHub Issues

[1819] Watch and reload api folder

prev: I am getting an 'Unexpected token import' error
next: Cannot initialise Vuex store from localStorage on App initialization for Authentication

How to make nuxt watch for "non standard" directories and recompile / reload itself, and more specifically for dirs with additional server apis?

I have my express api in ~/api/. Since I reference the directory in serverMiddleware with '~/api', I would expect Nuxt to reload when I make some changes to the files in that dir, but it doesn't.

You can reproduce it easily with the "auth routes" example. Any change in the api folder doesn't trigger the rebuild action. Since the initial build is not exactly fast, having to restop / restart the server manually for every change in the site api can become boring easily.

I'm simply using npm run dev that fires nuxt, I don't have any direct control on either nodemon (if it's used internally) or on webpack (that I'm pretty sure is). I tried adding watch: [ '~/api/*.js'], watch: [ '~/api/index.js'], watch: [ '~/api/**/*.js'] to build in nuxt.conf.js but with no luck.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1634">#c1634</a>)</em></sub></div>