Reputation: 3117
I am setting up a project has a structure like this:
components
folder contains lots of React components.
examples
folder is a folder uses components
as a local dependency
So, right now, the package.json
of examples
is like this:
{
...
"devDependencies": {
"components": "../components"
...
}
}
And I want the example
to recompile when I change the code in components
.
Any idea how can I do this?
EDIT
My project structure is like this, and I am using webpack
.
.
+-- components
| +-- index.js
| +-- package.json
+-- examples
+-- index.js
+-- package.json
Upvotes: 0
Views: 207
Reputation: 2990
If your project is using webpack then hot relaoding will work :https://webpack.js.org/concepts/hot-module-replacement/ Otherwise if it is just node you can use a server like nodemon eg:
$ npm install nodemon -g
$ nodemon app.js
This automatically pick up changes.
Upvotes: 1