admin管理员组文章数量:1401459
I am building a React ponent library and additional documentation project. My goal is to display immediately all changes of the library straight into the documentation.
So far I have configured webpack to watch for changes in the ponents. After rebuilding, I take the output folder and move it in the node_modules
of the documentation. This way I can simulate using my ponent library as an external package.
The documentation is a create-react-app
project and by default it does not watch for changes in node_modules
. I followed this answer and executed the eject
script. I updated the ignoredFiles
variable in webpackDevServer.config.js
and everything is working really fine. I make a change in a ponent, webpack repiles, updates the package in the node_modules
of the docs and then a rebuild is triggered. However, I have to refresh the browser to see the changes. Hot reloading happens when I do a change in the source of the docs, but it will be great to trigger it when I update that specific package in the node_modules
. Is there a way to achieve that?
Thank you for spending time on this!
I am building a React ponent library and additional documentation project. My goal is to display immediately all changes of the library straight into the documentation.
So far I have configured webpack to watch for changes in the ponents. After rebuilding, I take the output folder and move it in the node_modules
of the documentation. This way I can simulate using my ponent library as an external package.
The documentation is a create-react-app
project and by default it does not watch for changes in node_modules
. I followed this answer and executed the eject
script. I updated the ignoredFiles
variable in webpackDevServer.config.js
and everything is working really fine. I make a change in a ponent, webpack repiles, updates the package in the node_modules
of the docs and then a rebuild is triggered. However, I have to refresh the browser to see the changes. Hot reloading happens when I do a change in the source of the docs, but it will be great to trigger it when I update that specific package in the node_modules
. Is there a way to achieve that?
Thank you for spending time on this!
Share Improve this question asked Jan 24, 2020 at 8:40 Dimitar SpassovDimitar Spassov 2,7532 gold badges9 silver badges20 bronze badges1 Answer
Reset to default 4You can setup a local dependency that points to your package.
"dependencies": {
"package-name": "file:../relative/path/to/your/package"
}
Then, when you created the dependency, rebuild the relative path to the module containing your package.json in watch mode and you are ready to go!
版权声明:本文标题:javascript - How to trigger hot reloading for React when a package in node_modules is changed? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744290308a2599079.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论