Skip to content

theajr/react-with-nodemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Local setup for developing React library with nodemon

Have you ever wondered why don't we use nodemon in react development? If you are wondering how to develop a local react library and test it in sample application, this might help you.

Get Started

git clone https://github.com/theajr/react-with-nodemon.git my-react-pkg
cd my-react-pkg
npm i
npm start

Change name in package.json to your desire package name, example: my-react-pkg

Now you can change any js file in src folder and it will automatically transpile the code to dist.

Usage

You can keep making changes in this package and test in your sample project at the same time.

cd mySampleReactApp
npm install ABSOULTE_PATH_OF_CLONED_PACKAGE

Now, you can import your package into mySampleReactApp, Let's say you have an App.jsx in your mySampleReactApp

import React from "react";
import PropTypes from "prop-types";
import { Button } from "my-react-pkg";

const App = ({ name }) => {
  return (
    <div>
      Hello {name}
      <br />
      <Button text="Counter - " />
    </div>
  );
};

App.propTypes = {
  name: PropTypes.string.isRequired
};

export default App;

Publish you package!

cd my-react-pkg
npm run compile
npm login
npm publish

βœ… Done! You have published your package successfully! πŸ‘πŸ’₯πŸŽ‰

Limitations

  • No support for other imports than js/jsx

About

Why should webpack/parcel should have all the fun! Let's make try to make nodemon happy a bit πŸ˜‚πŸ€£

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published