reactjs - How to publish a jsx file to npm? -


i want publish react component npm, found out it's difficult. file simple, es6 syntax. steps or solution publish npm can install , run locally installed react? have read article http://chadly.net/2015/04/publishing-react-to-npm/, seems outdated , failed following it.

use babel-cli transpile file es5 , publish file.

put source-files in 1 folder, e.g. src , install babel , add build entry npm scripts (package.json/scripts): "build": "babel --out-dir=lib src".

no every time call npm run build. transpiled code in lib folder. in index.js refer lib folder-folder.

of course can add build script npm hooks such "prepublish": "npm run build" or similar,


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -