Giter Club home page Giter Club logo

react-webpack-component's Introduction

react-webpack-component

NPM version GitHub license

Base structure in Webpack 4 for the creation of npm modules in React

Installation

1. Clone

git clone https://github.com/kevoj/react-webpack-component.git your-react-component-name
cd [your-react-component-name]
npm install

2. Set name of the library

Replace in package.json

{
    "name": "your-react-component-name",
    ...
}

3. Create Link

npm run build
npm link

Development

Start

Watch changes in mode development

npm start

Build

Compile in mode production

npm run Build

Structure

 
|-- dist/lib (Compiled)
|   `-- index.js
|-- src/lib (Your code here, view example in code source...)
|   |-- Button/index.js
|   `-- index.js
`-- webpack.config.js

Test the component in a project

cd Existing-React-Project
npm link your-react-component-name

At this point you can already use your component, usage:

import React, { Component } from 'react';
import { Example } from 'your-react-component-name'

class HelloWorld extends Component {
  render() {
    return (
        <Example />
    );
  }
}
export default HelloWorld;

Production

Publish in NPM

1. Compile to production

npm run build

2. Login

npm login
# login with your credentials in https://www.npmjs.com/

3. Upload package

Note: Verify your version of the component in package.json, you can not upload the same version twice

npm publish
# Available in https://www.npmjs.com/package/your-react-component-name

Now, you can install your package with:

npm install your-react-component-name--save
# :)

License

MIT © Leonardo Rico

react-webpack-component's People

Contributors

kevoj avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.