-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Managing a copied node_modules
is tricky
#86
Comments
As I have been bitten by all these things, create-react-app writing in a cache folder, moving to Vite.js to avoid this, managing a copied Plus, I am interested into fixing the root cause of #85 as it is seriously a pain for the developer experience :/. |
Yes, we also switched to Vite from CRA, but additionally, we've also had to switch from I think |
@dhess Curious on how you used |
@RaitoBezarius It has required some bespoke |
Over in https://github.com/adisbladis/buildNodeModules I've taken another approach: To not overwrite files accidentally I took some inspiration from home-manager: |
Is your feature request related to a problem? Please describe.
Unfortunately, it's necessary to use
node_modules_mode = "copy"
withcreate-react-app
because it wants to writenode_modules/.cache
. (I've asked upstream for the ability to change this location: see facebook/create-react-app#11263)Using this mode is tricky to get right. So far I've discovered the following:
--package-lock-only
withnpm install
and similar commands.rm -rf node_modules
before running anynpm install
commands. Otherwise, it's possible to get Nix store links in yourpackage-lock.json
file, which is probably not what you want. See https://github.com/hackworthltd/react-nix-craco-public/commit/37b852373a507fe5b7419c1ce2c92cbae14f5593 and 211-character store path limit #85.Describe the solution you'd like
The project could benefit from some documentation along these lines. It might also be helpful if the shell included some
npm
wrapper scripts that enforce these best practices. Adding an optionalshellHook
to remove thenode_modules
directory when you're incopy
mode would be helpful.Describe alternatives you've considered
We've written some scripts to enforce these best practices in our project, but it's still easy to get something wrong, and the learning curve is a bit steep if you're not familiar with
npm
.The text was updated successfully, but these errors were encountered: