Skip to content
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

Document how to use zkApps with create-react-app #44

Closed
mitschabaude opened this issue Sep 26, 2022 · 1 comment
Closed

Document how to use zkApps with create-react-app #44

mitschabaude opened this issue Sep 26, 2022 · 1 comment

Comments

@mitschabaude
Copy link
Contributor

Quoting a great write-up shared by from Gordon Freeman on discord:

  1. npx create-react-app --template typescript

  2. npm run eject

  3. add the following line to the config/webpack.config.json in the return statement
    experiments: { topLevelAwait: true },
    (on my setup it is before the line target: ['browserslist'],)

  4. go to your zkapp project and type: npm link

  5. go to your react app and type: npm link
    5.1. make sure that the name matches the name in your zkapp package.json
    5.2 if there is a type stuff error during import use this // @ts-ignore right before the import statement in your react app
    // @ts-ignore
    import { Multisignature } from 'zkapp-multisign'
    https://stackoverflow.com/questions/64732623/react-typescript-cannot-find-module-or-its-corresponding-type-declaration

  6. if there is an import error you might have to set the file extension of your zkapp in
    /build/src/index.js manually (like this: import { Multisignature } from './Multisignature.js';) -- .js is the important part
    6.1 Don't forget to add this file extension after every build of your zkapp

@jasongitmail
Copy link
Contributor

Closing as an old issue.

We built support for NextJS into the zkApp CLI (via zk project <name> --ui next) and have chosen to focus our efforts and guide devs down NextJS path b/c it's a better, modern framework, a CRA workflow that requires using 'eject' will leave devs with a maintainence headache long term, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants