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

Update to vite #15

Merged
merged 7 commits into from
Jul 11, 2023
Merged

Conversation

dvkam
Copy link
Contributor

@dvkam dvkam commented Jun 20, 2023

Hey, I thought I might update the template. The App works still the same and looks the same.
Here is a list of the changes I did:

  • Replaced CRA with Vite as bundler. For context, the React documentation removed CRA as it is not longer recommended to start a react project this way and some reasoning behind this to read here Replace Create React App recommendation with Vite reactjs/react.dev#5487 (comment)

  • removed unused dependencies and updated to current versions e.g. taquito to v17

  • changed disableDefaultEvents to false in ConnectWallet component and removed the event handlers that were added back. The reason for this is that the beacon popup window did not disappeared automatically after the wallet was already connected/paired(Establishing Connection dialog does not clear after pairing wallet). (Maybe because of v4?) But with disableDefaultEvents: false the flow works just as intended.

  • added an anchor element for the displayed userAddress so its clickable to and redirects the user to tzkt to see his operations. Just like it works with the contract address already.

  • adapted the README file e.g. instead of npm run start its now npm run dev. And added short info how to build the app.

  • when running the build with Vite it didnt work because of the error in console require is not defined, to solve this the transformMixedEsModules was added to the vite.config

Let me know what you think.

@dsawali
Copy link
Contributor

dsawali commented Jul 10, 2023

Hello @dvkam, can you also provide some screenshots to inform how the template will run for a new user? As well as post your local Node and NPM versions for future reference? Thank you!

@dvkam
Copy link
Contributor Author

dvkam commented Jul 11, 2023

Hello @dsawali sure, so my Node and NPM versions are:

Desktop:
Node: v19.0.1
NPM: v8.19.2

Laptop:
Node: v16.13.2
NPM: v9.3.0

@dvkam dvkam changed the base branch from master to update-react-template July 11, 2023 19:47
@dvkam
Copy link
Contributor Author

dvkam commented Jul 11, 2023

Hi Davis. I updated the Readme file with more information and pointed the merge into the new branch as you asked.

@dsawali
Copy link
Contributor

dsawali commented Jul 11, 2023

@dvkam thank you! I'll merge your work into said branch and check it out locally

@dsawali dsawali merged commit 5a44e1e into ecadlabs:update-react-template Jul 11, 2023
@dsawali dsawali mentioned this pull request Jul 12, 2023
@dvkam
Copy link
Contributor Author

dvkam commented Jul 13, 2023

Hi, I believe the following issues can be closed with the merge of this PR:

#9 - can be closed as there is no react scripts usage anymore. So this error wont happen.
In order to run https in dev environment with a local certificate:

The Vite documentation suggest using their official package instead: @vitejs/plugin-basic-ssl
Install: npm i -D @vitejs/plugin-basic-ssl

Add to your Vite config:

import basicSsl from '@vitejs/plugin-basic-ssl'

export default {
  plugins: [
    basicSsl()
  ]
}

Run: npm run dev -- --https


#11 - uses latest beacon version. And Umami wallet interaction with the template works. I tested it myself.


#8 - is resolved, I believe this was due to the fact that in ConnectWallet.tsx the disableDefaultEvents was set to true, I have set it to false and the beacon flow works as it should since then.
grafik

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

Successfully merging this pull request may close these issues.

2 participants