create-react-app doesn't restart when changes happen in server code - create-react-app

using /src/setupProxy.js, I have import /server/index.js and start up a server api.
The trouble is that changes to files in /server/ directory do not restart the create-react-app so I don't see any of my changes until I kill it and restart it.
Is there a way to have create-react-app also watch the server directory for changes, or a way to use nodemon to run create-react-app?

it looks like you can do
nodemon create-react-app start
create-react-app does a better in place update in your browser when you make changes in the src directory, so you don't want nodemon triggering a restart in that case.
To avoid this, create a file called nodemon.json:
{
"ignore": ["src/*", "build/*"]
}
And then nodemon will only restart for non-react stuff updating.
I added the build directory too as it shouldn't be part of the restart.

Related

Get typescript-eslint to detect single run mode in yarn repository

I have been running into Out Of Memory errors with typescript-eslint in a monorepo with ~20 TypeScript projects. This is a known issue and one of the mitigations is to enable single run detection with the parserOptions.allowAutomaticSingleRunInference = true option. This doesn't appear to ever trigger in a yarn managed repository though. Looking at the source, will this ever work? It seems like because yarn runs in a /tmp directory it will never match the file path to detect single run mode:
$ yarn exec which eslint
/tmp/xfs-3826b2c0/eslint

How to run a development server in Laravel Mix (standalone project)

I'm trying to run a server to see my project on browser, the only way i can do it is running npx mix watch --hot, so after that my project start running at localhost:8080.
But the above command enable hot reload, i would like to know if there is some specific command to just run the server, without enabling hot reloading.
I tried npm mix watch but it not starts the server, just watch the files.
Tried calling manually webpack server with:
./node_modules/.bin/webpack serve --config="./node_modules/laravel-mix/setup/webpack.config.js"
This works (the server starts at localhost:8080 as well) but somehow it activates hot reloading too, idk why.
So, there is some way to just start the server? Without enabling hot reloading?
Here is my webpack.mix.js file:
let mix = require('laravel-mix');
mix.sass('src/scss/app.scss', 'dist/css/')
.js('src/js/app.js', 'dist/js/').react()
.setPublicPath('public');
My package.json has just the default script:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
If you're using Composer you can run php artisan serve, this will start a local php server and serve your web pages to the browser Laravel installation.

Nuxt deployment error: server resources are not available

To deploy our nuxt website in ssr mode we first build and unit test website in the bitbucket pipeline and if tests are green we copy build files from bitbucket servers to our production server and trigger start.
The problem is that Nuxt documentation says nothing about which exact files are required on the server.
currently we are using:
.nuxt/
server/
static/
nuxt.config.js
Sometimes after adding functionality to the website, deployed version throws an error:
Error: Server resources are not available!
At the same time local version works fine.
Also running production server locally on the project works.
Error kinda hints that some paths picked up incorrectly by nuxt.. but the directory structure is completely the same.
Any ideas why this happens and how to fix that?
If errors also mentions, Please check "file path"/.nuxt/dist/server existence.
Then on the terminal
cd .nuxt
check if 'dist' folder exists. If it does not exists,
go back and npm run build. this will generate the 'dist' folder for use.
If Still facing the issue, try,
npm install --save nuxt
npm install --save vue-server-renderer
Try adding: dev: process.env.NODE_ENV === 'DEV' to nuxt.config.js

Hot reloading with create-react-native app on vagrant

I have used create-react-native-app and expo to build an application on a vagrant ubuntu and run it using yarn start.
When i make changes to my file on my host machine, the changes are not
reflected.
With create-react-app, CHOKIDAR_USEPOLLING=true worked and all my
changes were reflected instantly but this is not the case for native.
Does anyone know how to get this to work?
Please try using yarn start instead of npm start since your current of npm (5) has issues with create-react-native-app as of today.

How to set npm not to install packages that had been installed globally?

My project references mocha, phantomjs, etc, which takes a lot of time to download during npm install. This is not a problem in my local machine because I only download them once and can use them forever unless I decide to manually upgrade them.
However, in my CI machine, my jenkins server need to download them every time that I did a git commit and git push to do the testing and deploy.
So can I just speed up that process by set the npm not to download these slow packages from the remote server? Rather, install them from local cache or not to install them if I installed them globally?
Anyone knows how to configure that?
I found some packages that might be helpful
npm-install-changed will run npm install only if the contents of package.json's devDependencies and dependencies were changed, note that it assumes that node_modules persists across different builds which might not be helpful if your CI server always start from scratch
npm-install-cache runs npm install and then copies your current node_modules folder (to somewhere in \tmp), if you call the script again it will verify any changes to package.json (instead of changes done on devDependencies or dependencies), if it didn't change then it will copy the node_modules folder stored in \tmp, the only limitation I see is that it's not cross platform and that the cache folder is \tmp which is erased on reboot (or maybe even when a is process finished!)
The second package might not work as it is but it seems like a good place to start :)
You can specify all of the packages you want to use locally in devDependencies in package.json, and then running npm install -d will install those instead of the main dependencies.