7yl4r / react_component

1 stars 3 forks source link

Usage example? #3

Open 7yl4r opened 3 months ago

7yl4r commented 3 months ago

I can't get this to import into an example react app from following the advice in the template's README. Maybe it is out of date? Can someone check my methods below or provide alternative guidance?

Steps to reproduce:

 npx create-react-app react-vocab-suggester-test-app --template typescript
 cd react-vocab-suggester-test-app/
 npm install git+ssh://git@github.com/7yl4r/react_component
 sed -i '1iimport { Button } from "@7yl4r/vocab_suggester";\n' src/App.tsx 
 npm run start

This will yield the following error:

Compiled with problems:
ERROR in src/App.tsx:1:24
TS2307: Cannot find module '@7yl4r/vocab_suggester' or its corresponding type declarations.
  > 1 | import { Button } from "@7yl4r/vocab_suggester";
      |                        ^^^^^^^^^^^^^^^^^^^^^^^^
    2 |
    3 | import React from 'react';
    4 | import logo from './logo.svg';

I can confirm that @7yl4r/vocab_suggester has been added to the package.json. I tried clearing the cache as suggested by ChatGPT and did this twice to be sure.

Dylan-Pugh commented 3 months ago

Just chiming in to say I can reproduce this. As a React novice I'm not sure the best way to debug, but I know that create-react-app is deprecated, so I wonder if that's a contributing factor.