method
Use patch-package to patch the package in node_module to solve the problem of modifying the source code
use
1. Download the patch-package package: npm install patch-package -D
2. Add the command in the package.json file: "postinstall": "patch-package"
{ "scripts": { "serve": " vue-cli-service serve", "build": " vue-cli-service build", "postinstall": "patch-package" } }
3. Run: npx patch-package zx-layouts (modified package name)
Result: Create patch file
The root directory will automatically generate a patches file to store the modified content, including the modified file location and modification information
Delete node_module, then reinstall the dependencies, and the patch will take effect
The companion pulls the code, including the modified patch file, which will overwrite the source code