Source:  Twitter logo

I use react-redux-snackbar I want to improved the style into this package, I modify the package from node_modules but nothing happens.

When modify node_modules into the folder of this plugin, I would like to mmodify the stylesheet but nothing happens.

Do you have any recommandations, like fork the project and create my own plugin ?

Yes, you can. Few options:

  • Submit a pull request on the project and wait for the author to release it.
  • You can fork the project yourself on github and publish it.
  • Use a symlink by going to the source folder and using npm link and then reference it in your project. Instructions.
3 users liked answer #0dislike answer #03
Paul Redmond profile pic
Paul Redmond

the approach I used for this was to keep a pre-built customised copy in my source tree, and then clobber the module version with it:

  "scripts": {
    "postinstall": "cp -r ./src/mycom/lib/tinymce/* ./node_modules/tinymce/",

this works after npm -i and in e.g. CI setups. I forked the repo for the lib (tinymce) that i was having trouble with, edited its source, and then built it.

i don't know the npm lib file/folder structure at all really but i copied the ./js folder content into my lib folder and from there into node_modules at install time and it seems to work.

don't forget to tell your linter to ignore your lib folder also e.g.

"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}' --ignore-pattern 'src/mycom/lib' --quiet",
"lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --ignore-pattern 'src/mycom/lib' --fix --quiet",
3 users liked answer #1dislike answer #13
user326608 profile pic
user326608

If you want to update package in node_modules, you have to make your changes in project and you rebuild project in node_modules. The rebuild steps are probably in the Readme.md. But if you update project from npm install or other way, probably your project is gonna crash.

1 users liked answer #2dislike answer #21
immino profile pic
immino

If you want some improvement in some dependency. This is the right time you can make a Pull Request to that repo. So it would be available to everyone using the same package. Most importantly if you're working in a team. We don't push node_modules in repo. Other members will download packages remotely so your changes will not be reflected there. I hope you got my point.

0 users liked answer #3dislike answer #30
Sakhi Mansoor profile pic
Sakhi Mansoor

Important thing you should know, whenever you are making change in node_modules folder, you need to rebuild your project to see its effect,

Now if you have modified node_modules and you restarted your server you will see changes

real issue will occur whenever in future you will try to do npm i it will automatically override your changes,

solution to this,

  1. Fork project on your GitHub
  2. Clone project on your system
  3. Create two branches stable-verison & modified-version
  4. Push your desired changes in modified-version branch

you will use stable-verison branch to sync latest changes from original repo

How you will use this modified-verion branch there 2 ways,

  1. Publish your branch as new package on npm
  2. Use SHA commit hash to use directly in package.json

here is example for 2nd option Open up your package.json file, and replace MODULE, USER, REPO, and SHA with the info from the GitHub repo.

"MODULE": "https://github.com/USER/REPO/commit/SHA",

in your case:

"react-redux-snackbar": "https://github.com/yourUser/react-redux-snackbar/commit/Your-Modified-Commit-SHA"

i hope this works for you

0 users liked answer #4dislike answer #40
Hanzla Habib profile pic
Hanzla Habib

to update a package you nromally run something like npm install react-redux-snackbar@latest

-1 users liked answer #5dislike answer #5-1
Sudsy profile pic
Sudsy

Copyright © 2022 QueryThreads

All content on Query Threads is licensed under the Creative Commons Attribution-ShareAlike 3.0 license (CC BY-SA 3.0).