mliebelt / pgn-viewer

Simple PGN viewer with the necessary features to display chess games
GNU General Public License v3.0
159 stars 44 forks source link

Latest version 1.6.7 does not seem to work in React #534

Closed ppeloton closed 4 months ago

ppeloton commented 4 months ago

When trying to create a simple React app with pgn-viewer, an error is shown: export 'pgnView' (imported as 'pgnView') was not found in '@mliebelt/pgn-viewer' (module has no exports)

If one installs 1.6.0, the app works so the issue seems to relate to the latest version (1.6.7) only. I used the code from the react.md file.

mliebelt commented 4 months ago

Ok, I will try that myself. The code for react was provided by someone else, and there were a few 100 changes since then, but I will give it a try. Will take some time though ... If you have: what is the minimal setup for react, so that this example might work? I will need to have a separate package for it, so a package.json file would be helpful.

ppeloton commented 4 months ago

Hi, I made a pull request with a minimal react example and instructions how to set it up.

The package.json looks as follows (if you change the version of "@mliebelt/pgn-viewer" to 1.6.0 and reinstall the example works)

{ "name": "test-app", "version": "0.1.0", "private": true, "dependencies": { "@mliebelt/pgn-viewer": "1.6.7", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "react": "^18.2.0", "react-children-utilities": "^2.10.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", "web-vitals": "^2.1.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }

mliebelt commented 4 months ago

The reason for it was my switch to type: module in package.json. Took that back, works again. I have to invest more into the problem, before I enable type module again ... :-(

ppeloton commented 4 months ago

Thanks a lot, 1.6.8. works fine for me!