Skip to content

Conversation

@penn201500
Copy link

Fix: DeprecationWarning: The util.isArray API is deprecated. Please use Array.isArray() instead.

Since modifying files in node_modules will be overwritten when you run npm install, use patch-package to persist these changes.

  1. npm install patch-package postinstall-postinstall
  2. Modify flash.js
  3. npx patch-package connect-flash
  4. Add the following script to your package.json to ensure the patch is applied after each npm install: "scripts": {
    "postinstall": "patch-package"
    }

Fix: DeprecationWarning: The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.

Since modifying files in node_modules will be overwritten when you run npm install, use patch-package to persist these changes.
1. npm install patch-package postinstall-postinstall
2. Modify flash.js
3. npx patch-package connect-flash
4. Add the following script to your package.json to ensure the patch is applied after each npm install:
"scripts": {
  "postinstall": "patch-package"
}
@Chorwhat
Copy link

Hi @penn201500 I came across this PR after encountering the same error. I also noticed my changes get overwritten whenever i run npm install. My question is if the source code for this package was changed to use Array.isArray() instead, would the patch still be needed? Why is the proposed solution to add a patch to change the source instead of changing the source directly?

Sorry if this is a noob question, I am learning

@penn201500
Copy link
Author

Hi @penn201500 I came across this PR after encountering the same error. I also noticed my changes get overwritten whenever i run npm install. My question is if the source code for this package was changed to use Array.isArray() instead, would the patch still be needed? Why is the proposed solution to add a patch to change the source instead of changing the source directly?

Sorry if this is a noob question, I am learning

Hi, @Chorwhat. Suppose the source code for this package fixed the warning. The patch is not needed anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants