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

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -