score:1
you should never make changes to node_modules due to the reason you have described, your changes are just temporary, and if you decide to update the dependency your changes will be lost.
depending on your reason for changing the code, you can do other things:
- if this is a feature, you can request it to make them, or open a pull request for them
- if its a bug, open a bug for them, or again make a pull request it to solve it
if you want to make changes that persist then you have to make your own library that is based on theirs (assuming their license allowing you yo do so), this is a really bad option, you lose all the automatic updates, and bug fixes.
what you should do is what you suggested, is that you should build a wrapper component over their component, and in that case you are not adding any new dependencies (the dependencies they use will be there anyway, unless you decide to build the component from the scratch using their dependencies, in this case this is not a wrapper component but a whole new component, avoid this option if you can just wrap their component to achieve what you want)
score:1
we have solve this issue by creating update_note_modules.sh(shell executables) file and run this file after every npm/yarn install
step 1: save copy of your code from node_modules to your main application folder . we have created "core" folder and save copy there
step 2 : create update_note_modules.sh file
file code
echo "updating react-native-dropdownalert"
cp core/react-native-dropdownalert/dropdownalert.js node_modules/react-native-dropdownalert/dropdownalert.js
echo "node_modules updated"
note: path will change according to your project
step 3: run update_note_modules.sh after every npm/yarn install
just paste the path of file in terminal and hit enter to execute file
/path to file/update_note_modules.sh
score:1
i would recommend https://github.com/ds300/patch-package here; makes patches and apply them consistently to things in node_modules. often useful for fixes that were never pushed to certain versions of packages.
Source: stackoverflow.com
Related Query
- How to persist changes made in node_modules?
- How to use Native Node Modules on a React, ES6, Electron App?
- How to import modules from a folder outside node modules in next js
- How to use tree shaking for node modules with Webpack 5?
- Why changes made to a node module does not apply to React.js app?
- How to disable the css changes made by Link/href
- How can I keep track of changes made in redux store
- How to build a multi package node module with some optional modules
- How to change the content of CSS node modules in Ionic react?
- How to fix: Npx create-react-app does not install everything only package.json and node modules
- React: How to figure out import path of node modules
- How can I add modules in node install modules under node_modules to browser?
- How to test changes made by onClick event that calls a setState function, which is passed from another component and changes UI?
- How to disable a submit button if no changes were made in an input field?
- How to merge different node modules and make different bundles from them?
- In React Project, how to change and customize node modules
- How to listen state changes in react.js?
- using css modules how do I define more than one style name
- How can I persist redux state tree on refresh?
- How to apply global styles with CSS modules in a react app?
- ES6 modules implementation, how to load a json file
- How to listen for specific property changes in Redux store after an action is dispatched
- How to import CSS modules with Typescript, React and Webpack
- How to use css modules with create-react-app?
- How to nest classes in css modules and react?
- Jest: How to correctly mock a node module?
- How do you send images to node js with Axios?
- React tutorial - how do I start the node server for a reactJs application?
- how to check the actual DOM node using react enzyme
- How does react-router persist location state over page refreshes?
More Query from same tag
- React redux architecture: where to do data organization - action or store or component?
- How do I make sure my first render with React has a value from localStorage?
- Is there a better way to pass in components using hooks? My solution is provided
- Cannot post error react js
- React Data Grid rows disappearing on dynamically providing height
- React: fetch call's then function not being called
- Uncaught TypeError: data.map is not a function. react functional component
- webkit does not animate opacity
- How can i pass and display data from one component to other component?
- How to namespace es6 classes (for React components)
- Form submission does not work with validationSchema
- How to fix 'flattenChildren(...): Encountered two children with the same key' with React and Semantic UI
- Why does passing a static dependency to an useEffect causes it to be called every render?
- React Bootstrap - spinner and button in one line
- React display not updating correctly
- React - Prevent scrolling to top after changing query params
- useEffect not updating state
- Material UI / material-ui appbar leftnav toggle not working
- Passing an object from React to Express and creating a new Airtable record
- Correct way to use CSSTransitionGroup and Redux Connect
- react-beautiful-dnd doesn’t work properly with react-virtualized Table component
- How to control the position of the text in the selector in antd UI?
- Material UI: Class names in development are uglified
- React ES6 class method does not render into html table but outside it. Why?
- How to not clear input field onClick
- Optional Path React Router 4
- Render view on click Reactjs
- Reusing a modal, in a React component, with different children
- How to write code by the new rules of reactjs version
- Abnormal behaviour of radio button when click