This is a starting webpack template for a ReactJS project.
Installing all the dependencies:
npm install
Checking if some updates are available (I use npm-check-updates):
npm run update
Install updates:
npm run install
Build for production:
npm run build
Watch for developement:
npm run watch
Developement web server:
python3 -m http.server
curl http://0.0.0.0:5000/
npm install
npm run update
npm run build
npm run watch
npm run serve
The developement server runs with "serve".
I usually have a Python application server do serve APIs. In this case it is necessary to setup a proxy configuration for Parcel, in order to dispatch some API calls to the developement server.
I define a .proxyrc.json file in this way (documentation):
{
"/api": {
"target": "http://dev:8000/",
"pathRewrite": {
"^/api": "/api"
}
}
}
In the sample above, all API calls starting with /api are redirected to something running on another port (also another domain).
npm install
npm run update
npm run build
npm run serve
The developement server runs with "serve".
Here I have a simple Python3/Sanic web server.
sudo docker run --rm -it -p 5000:8000 -d bacchilu/sanic-app
curl http://0.0.0.0:5000/json