backpack icon indicating copy to clipboard operation
backpack copied to clipboard

Documention on how to change environment.

Open george-norris-salesforce opened this issue 6 years ago • 1 comments

Thanks for this awesome library! Have a question about changing environment variables.

I've been looking though the issues, and there are several closed issues asking how to change the environment var when building assets. As far as I can tell, there is no answer yet. Is possible for this project to document how this is accomplished?

For our project, we really need to change the environment for setting up monitoring, S3 configs and other configuration based on environment. We haven't able to do this using backpack so far. We've tried changing the NODE_ENV in .env (using dotEnv), changing the mode in the backpack.config, etc.

Anyways, if this is possible.. would be excellant if there could be some sort of documention on how this in done. Thanks!


in .env NODE_ENV=production // run in development

module.exports = {
  webpack: (config) => {
    config.mode = 'production';
 ....

// run in development

You can do this in your package.json scripts. Here's an example:

"scripts":{
    "build": "backpack build ./src/index.ts",
    "build:production": "NODE_ENV=production yarn build"
}

Zlass avatar Sep 05 '19 16:09 Zlass