You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Buildpack should be able to do npm run build without errors.
Current Behavior
Building with buildpacks, with the example project, fails with "Module not found" error.
Paketo Buildpack for Node Run Script 1.0.4
Executing build process
Running 'npm run build'
> reactapp@0.1.0 build
> react-scripts build
Creating an optimized production build...
Failed to compile.
Module not found: Error: Can't resolve '@my-dummy-namespace/dummy-component' in '/workspace/src'
Building directly with npm works, npm install, npm run build complete without errors.
I've been able to reproduce the issue and I think I see what the problem is. We aren't really supporting workspaces with what we are doing with the node_modules layer and the symlink indirection. Let me explain.
When you npm install and reference workspaces, the package-lock.json just includes some file path references to where those workspaces are relative to the package-lock.json file. This is fine as long as the node_modules directory stays put. However, in order to make layer caching work well, we are moving the node_modules directory to /layers/paketo-buildpacks_npm-install/build-modules/node_modules and then doing some symlink redirection to make this work. Unfortunately, those file path references in the package-lock.json file are now broken since they were relative to the original location of the node_modules directory.
The solution to this is likely to add more explicit support for workspaces into the npm-install buildpack so that these workspace packages move along with the node_modules directory and their paths don't get messed up.
ryanmoran
transferred this issue from paketo-buildpacks/node-run-script
Apr 6, 2023
Expected Behavior
Buildpack should be able to do npm run build without errors.
Current Behavior
Building with buildpacks, with the example project, fails with "Module not found" error.
Building directly with npm works, npm install, npm run build complete without errors.
Project structure and approach to using linked modules follows this example: https://www.developerway.com/posts/react-project-structure
Possible Solution
Steps to Reproduce
Minimal working example is at https://github.com/jansu76/react-problem
To reproduce error:
Motivations
I am unable to use buildpacks to build a larger project which uses this type of linked modules extensively.
The text was updated successfully, but these errors were encountered: