-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add fixes to the nextjs project for snarkyjs + typescript #287
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this!
webpack(config) { | ||
config.resolve.alias = { | ||
...config.resolve.alias, | ||
snarkyjs: require('path').resolve('./node_modules/snarkyjs'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why this is required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures that the smart contract's snarkyjs and the ui's snarkyjs are the same - otherwise they get imported multiple times. See here for more, in the context of fixing this for duplicate instances of react
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Peer dependancies appeared to fix this issue for contracts imported via npm but not via npm link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @es92 this link is a nice resource! another potential trick with npm link is mentioned here (at the bottom): https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* add fixes to the nextjs project for snarkyjs + typescript * disable react strict mode in nextjs to prevent double loading useEffects * fix some thigns per comments * add ts-watch command to package.json * update script per comments Co-authored-by: Evan Shapiro <[email protected]>
* feat: add snarkyjs resolve alias nextconfig * feat: read ui current index file * feat: add index file extension from user selection * feat: add ui index template file * add ui newindex template * feat: import contract in template * feat: add snarkyjs to ui index * feat: add contract to local ui state * refactor: remove webpack config * feat: add SnarkyJS to the ui project package.json dependencies * fix: use path.join when updating package.json * fix: use path.join when updating package.json in 2nd place * add fixes to the nextjs project for snarkyjs + typescript (#287) * add fixes to the nextjs project for snarkyjs + typescript * disable react strict mode in nextjs to prevent double loading useEffects * fix some thigns per comments * add ts-watch command to package.json * update script per comments Co-authored-by: Evan Shapiro <[email protected]> * fix: add head import to index template * feat: build template contract to include in ui scaffold * update: invoke import async function * feat: create a contract instance in template * refactor: add commont for strict mode nextjs config option * refactor: add jsx extension to next index file * refactor: rename next index file * fix: remove redundant code * refactor: remove local state and update comments in ui template * feat: add snarkyjs resolve alias nextconfig * feat: read ui current index file * feat: add index file extension from user selection * feat: import contract in template * refactor: remove webpack config * refactor: add custom index to scaffold before ghp config * fix: remove duplicate code * update: change template zkapp address * update: change deployed example contract public key * feat: show console message to add a zkapp public key * feat: change emtpy zkapp address error message * fix: NextJs config snarkyjs require path for Windows Co-authored-by: Jason <[email protected]> Co-authored-by: Evan <[email protected]> Co-authored-by: Evan Shapiro <[email protected]> Co-authored-by: Martin Minkov <[email protected]>
No description provided.