Open Lancelot0105 opened 2 months ago
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.
The ideal case should be :-
@Lancelot0105 , I'm experiencing the same issue and would appreciate any support here
It was introduced with https://github.com/paketo-buildpacks/npm-install/commit/04b8c7d739f6802fb3be8a5971b8c06fd40678cf
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.
@c0d1ngm0nk3y But even though the end artifact is running with the development build environment of react right ? Which shouldn't be happening so.
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