dilidili / react-drawing-board

demo
https://react-drawing-board-demo.dilidili.now.sh
MIT License
68 stars 21 forks source link

Adds prepare to package.json #22

Closed gabrielguilhoto closed 2 years ago

gabrielguilhoto commented 2 years ago

I forked the repository and added it as a dependency of another project, but I would get the following error message: Module not found: Error: Can't resolve 'react-drawing-board'. I found that was happening because the "compiled" files on the lib directory, such as plain JS and CSS files, were absent. Only the src directory, which had TypeScript and Less files, was present.

I found out that the problem could be solved if the library defined a prepare script on package.json (see https://stackoverflow.com/a/57829251/12440938). After doing that, the fork could be successfully used.

This PR fixes #21.

dilidili commented 2 years ago

Hi @gabrielguilhoto , thank for creating pull requests. Could you provide which version do you use in your project? I just test by installing the lib by npm and the lib/* is exists.

gabrielguilhoto commented 2 years ago

@dilidili which version do you mean? The npm version? It is 7.21.0, although we use Yarn on our project. Or was it the react-drawing-board version? The fork I used was based on the 0.3.6 version.

But the problem does not happen when installing the lib as a standalone project with npm. It happens if I try to add the GitHub repo as a dependency on another project (for example, with yarn add https://github.com/dilidili/react-drawing-board). If the package.json on the lib is changed to have the prepare script the problem stops happening.

dilidili commented 2 years ago

@dilidili which version do you mean? The npm version? It is 7.21.0, although we use Yarn on our project. Or was it the react-drawing-board version? The fork I used was based on the 0.3.6 version.

But the problem does not happen when installing the lib as a standalone project with npm. It happens if I try to add the GitHub repo as a dependency on another project (for example, with yarn add https://github.com/dilidili/react-drawing-board). If the package.json on the lib is changed to have the prepare script the problem stops happening.

Got that thanks! I'll merge this PR.