Hey Alex - Great post! I'm setting up a component library for my team and I'm using this article as a guideline. I need to provide documentation for the next developer to integration test the npm package locally within a consumer app on their machine, as a way to validate their changes to the npm package, before pushing the package to npm. Use case:
1 - I cloned the repo at the url that you provided
2 - I ran npm install on the root folder
3 - I ran npm run rollup on the root folder
4 - I copied the dist folder created by npm run rollup from your app to my-test-app under the src dir
5 - I ran the following command from the command line at the root of my-test-app:
npm install --save ./src/dist
6 - After step 5, your package reflects in my-new-app node_modules as @YOUR_GITHUB_USERNAME/YOUR_REPOSITORY_NAME
7 - I imported the component in App.js and intellisense resolves it without error:
import {Button} from "@YOUR_GITHUB_USERNAME/YOUR_REPOSITORY_NAME";
However, when I npm start my-new-app, the following error is displayed in the console and app:
Module not found: Error: Can't resolve '@YOUR_GITHUB_USERNAME/YOUR_REPOSITORY_NAME' in 'C:\my-test-app\src'
Any idea what the issue might be or how to resolve? I did a lot of research online and found some potential matches but no working fix
Hey Alex - Great post! I'm setting up a component library for my team and I'm using this article as a guideline. I need to provide documentation for the next developer to integration test the npm package locally within a consumer app on their machine, as a way to validate their changes to the npm package, before pushing the package to npm. Use case:
1 - I cloned the repo at the url that you provided
2 - I ran npm install on the root folder
3 - I ran npm run rollup on the root folder
4 - I copied the dist folder created by npm run rollup from your app to my-test-app under the src dir
5 - I ran the following command from the command line at the root of my-test-app:
npm install --save ./src/dist
6 - After step 5, your package reflects in my-new-app node_modules as @YOUR_GITHUB_USERNAME/YOUR_REPOSITORY_NAME
7 - I imported the component in App.js and intellisense resolves it without error:
import {Button} from "@YOUR_GITHUB_USERNAME/YOUR_REPOSITORY_NAME";
However, when I npm start my-new-app, the following error is displayed in the console and app:
Module not found: Error: Can't resolve '@YOUR_GITHUB_USERNAME/YOUR_REPOSITORY_NAME' in 'C:\my-test-app\src'
Any idea what the issue might be or how to resolve? I did a lot of research online and found some potential matches but no working fix
Were you able to solve this issue?