Developer frustrations caused by Cache's
When making subtle changes to CSS or even more significant changes, both the browser cache and the parcel-cache can mask the changes. This can cause frustration particularly when a change breaks the design but the caches hide this for a period of time.
The parcel-cache can be deleted manually prior to a re-compile. I made some changes to the package.json to perform this automatically with a new script ‘npm run fmdev’.
I also used ‘npm install open’, to automatically open the browser for DEV mode.
Using the Chrome developer tool you can switch the browser cache OFF when in developer mode. Since doing these changes I can rely on my changes rendering immediately. This is great when working with CSS when aiming for pixel perfect outcomes.
When using DEPLOY mode, I notice that the web viewer will still maintain a cache and I have no ideas how to avoid it. So I do as much as possible using DEV mode and then switch to DEPLOY mode only when I need data from Filemaker to continue with testing.
Here is my package.json. I hope it helps.
Comments appreciated.
Michael
{"name": "js-dev-env",
"version": "2.1.0",
"author": "jeremy@integratingmagic.io",
"license": "MIT",
"description": "a generic development environment for developing JS in FileMaker",
"scripts": {
"start": "parcel index.html --no-source-maps",
"build": "parcel build index.html",
"upload": "node ./scripts/upload",
"deploy-to-fm": "npm run clear-cache && npm run build && npm run upload",
"fmdev": "npm run clear-cache && npm run open-site && npm start",
"openfile": "node ./scripts/openFileOnServer",
"test": "echo \"Error: no test specified\" && exit 1",
"clear-cache": "rm -rf .parcel-cache",
"open-site": "open http://localhost:1234"
},
"browserslist": "> 0.5%, last 2 versions, not dead",
"devDependencies": {
"eslint": "^8.16.0",
"eslint-config-prettier": "^8.5.0",
"open": "^8.4.2",
"parcel": "^2.8.1",
"prettier": "2.6.2"
},
"dependencies": {
"jsonata": "^2.0.4"
}
}