Hey, I have a quick question regarding this bit:
And NEVER forget to change it when generating every new service worker
Should the REACT_APP_VERSION_UNIQUE_STRING only change when making changes to the service worker, or upon every build and deploy?
REACT_APP_VERSION_UNIQUE_STRING
It should be on every build and deploy. Since on every build and deploy you have new files. But you can make it automated - add Date String prefix, suffix etc...
Thank you!
If anyone is interested, I've edited this script found on SO to replace my "build": "craco build" command in package.json:
"build": "craco build"
package.json
const execSync = require("child_process").execSync; const env = Object.create(process.env); const generateId = () => Math.random().toString(36).substr(2, 9); env.REACT_APP_VERSION_UNIQUE_STRING = `${generateId()}-${generateId()}-${generateId()}`; console.log("Used env variables: " + JSON.stringify(env)); console.log("Run command: 'craco build'"); execSync("craco build", { env: env, stdio: "inherit" });
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey, I have a quick question regarding this bit:
Should the
REACT_APP_VERSION_UNIQUE_STRING
only change when making changes to the service worker, or upon every build and deploy?It should be on every build and deploy. Since on every build and deploy you have new files. But you can make it automated - add Date String prefix, suffix etc...
Thank you!
If anyone is interested, I've edited this script found on SO to replace my
"build": "craco build"
command inpackage.json
: