Tan Dat
Tan Dat

Reputation: 3117

Recompile when local dependency is changed

I am setting up a project has a structure like this:

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

Answers (1)

Afshin Ghazi
Afshin Ghazi

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

Related Questions