2

1. Modify the local dependency code and generate a patch file

1. Install patch-package

npm i patch-package

2. Add { "postinstall": "patch-package" } to the scripts of package.json, this is a hook of npm, which will be executed after the dependent package is installed

3. Modify the code in node_modules

4. Generate patches

npx patch-package your-edited-package-name

5. After submitting patches, reinstall the package and you will find that it is the result of your modification

2. Modify the deployment configuration:

  • Do not use cache dependencies
  • Execute with administrator privileges
    If there is no --unsafe-perm, an error will occur, resulting in unsuccessful patch replacement.

Reference article:


chenyunqing
255 声望15 粉丝