Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documention on how to change environment. #164

Open
george-norris-salesforce opened this issue Jul 15, 2019 · 1 comment
Open

Documention on how to change environment. #164

george-norris-salesforce opened this issue Jul 15, 2019 · 1 comment

Comments

@george-norris-salesforce
Copy link

george-norris-salesforce commented Jul 15, 2019

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

@Zlass
Copy link

Zlass commented Sep 5, 2019

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"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants