I wrote this npm module, react-heartbeat, using nwb. When I install this module in a new project, npm i react-heartbeat
, just after running npm init
it takes less than 2 seconds and only installs 1 package. When I install this module, again npm i react-heartbeat
, after creating a project with create-react-app
, it takes nearly 3 minutes, adds 420 packages, removes 218 packages and updates 1257 packages.
What am I doing wrong?
My npm module is very simple, just 1 React component. It has no dependencies in the package.json
file. The following peer dependencies and dev dependencies that were created when nwb set the project up.
"peerDependencies": {
"react": "16.x"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
"nwb": "^0.23.0",
"react": "^16.5.2",
"react-dom": "^16.5.2"
},
I followed the instructions from nwb's documentation to prepare my module for publishing (npm run build
) and to publish my module (npm publish
). The proper folders are white-listed in my package.json
:
"files": [
"es",
"lib",
"umd"
],
I ran npm publish --dry-run
and confirmed that only the following 7 files are included in my project:
package.json
README.md
es/index.js
lib/index.js
umd/react-heartbeat.js
umd/react-heartbeat.min.js
umd/react-heartbeat.min.js.map
I am wondering if the problem is in the peer or dev dependencies, but I am not sure how to fix this.
Here is the source code for react-heartbeat. It can be found here on npm.
create-react-app
is supposed to install it's dependencies but maybe it failed. Every time you run npm i
it will install missing dependencies from package.json
.
Make sure dependencies are installed before installing yours by running npm i
and check nothing new.