Skip to content

Always overriding NODE_ENV with development #691

@MilosMoravac

Description

@MilosMoravac

Expected Behavior

When NODE_ENV is specified it should override development and not the other way around.

Current Behavior

Whatever is set during build environment install process it will be overridden to development

Possible Solution

Steps to Reproduce

  1. Pull samples/web-servers/react-frontend-sample
  2. pack build --clear-cache paketo-demo-app --builder paketobuildpacks/builder-jammy-base
  3. Logs for buildpack for NPM install 1.4.0 show following:
    Configuring build environment NODE_ENV -> "development" PATH -> "$PATH:/layers/paketo-buildpacks_npm-install/build-modules/node_modules/.bin"

Motivations

First of all I am a devops so this isn't really my cup of tea. So this is an issue my team has run into while using vite where the front builds and its throwing them errors. Whatever we do in nginx.toml it still uses the NODE_ENV=development. In the buildpack source code I found an override that always overwrites the variable you set with development I could be wrong but don't have many ideas left. I've tried locally to append env variable to 'pack build ' using --env but it does nothing.

This is the line of code I am suspecting is the issue. layer.BuildEnv.Override("NODE_ENV", "development") located here

layer.BuildEnv.Override("NODE_ENV", "development")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions