NODE_ENV
to production
for uploading to our main branch, and development
for uploading to our Simulation branch. First we'll catch the environment variable and assign the compile target based on it.package.json
to pass the environment variable before running the rollup command.cross-env
.npm run deploy-dev
or npm run deploy-prod
and see if your code is uploaded properly.rollup-plugin-replace
.rollup.config.js
to include your desired variables.rollup-plugin-replace
goes before other plugins, so we can be sure Rollup replaces these variables correctly and the remaining plugins can apply any optimisations (e.g. dead code elimination) correctly.JSON.stringify
.__REVISION__
).