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

UI applications built by buildpacks is not using react production build #756

Open
Lancelot0105 opened this issue Aug 27, 2024 · 4 comments

Comments

@Lancelot0105
Copy link

Lancelot0105 commented Aug 27, 2024

The UI applications built by buildpacks is not using build assets of react. Even though the NODE_ENV is setup during the build time, it is getting overwritten by npm-install buildpack.

Expected Behavior

NODE_ENV should not be overwritten by the npm-install buildpack

Current Behavior

NODE_ENV is getting overwritten by the npm-install buildpack.

Possible Solution

I believe if the code can be configured to use default NODE_ENV, this should work.

Steps to Reproduce

Build any UI application using the nodejs buildpack, see the NODE_ENV which is getting assigned during npm-install buildpack.

Motivations

In a world of CI/CD, in the production environment the basic necessity of any built application is to use the Production asset of the tool. Using a development build contradicts the whole purpose.

I believe a similar issue was raised here:

@andymoe @nebhale @anthonydahanne @ryanmoran

@AshwinSridharan0410
Copy link

Hi @Lancelot0105 , I too face this issue and would like to know the solution here.

As rightly said, if the image built with buildpacks goes into production , it shows me that I am seeing a development build of react.

image

The ideal case should be :-
image

@swathika1
Copy link

@Lancelot0105 , I'm experiencing the same issue and would appreciate any support here

@c0d1ngm0nk3y
Copy link
Contributor

c0d1ngm0nk3y commented Sep 5, 2024

It was introduced with 04b8c7d

If the modules are required at build time a separate layer will be
created that will install node_modules with the same logic as setting
NODE_ENV=development meaning all devDependencies will be available
for subsequent buildpacks to access. However only dependencies that
conform to the default or user set NODE_ENV will make it onto the final
running image.

So we have conflicting requirements here, right? We want to install dev_dependencies for the following buildpacks and use NODE_ENV=production for react.

see this comment for details.

@Lancelot0105
Copy link
Author

@c0d1ngm0nk3y But even though the end artifact is running with the development build environment of react right ? Which shouldn't be happening so.

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

4 participants