didof-dummy-react-npm-module
v1.0.0
Published
my first react component npm module
Downloads
2
Readme
How to Reproduce
npm init
precautions: unique package namenpm i -D @babel/cli @babel/core
create
.babelrc
{
"presets": ["@babel/preset-react", "@babel/preset-env"]
}
create the Componet in
src/index.js
add a script in
package.json
...
{
"scripts": {
"build": "./node_modules/.bin/babel src --out-file index.js"
},
}
...
It reads the code in src
and transpiles it to ES5 in a new index.js
file. The latter il located in root.
- add
react
andreact-dom
both asdevDependencies
andpeerDependencies
inpackage.json
"peerDependencies": {
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/preset-react": "^7.12.10",
"react": "^17.0.1",
"react-dom": "^17.0.1"
}