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

fix: use production version of react/jsx-runtime #63

Merged
merged 3 commits into from
Jun 11, 2021

Conversation

magicmatatjahu
Copy link
Member

@magicmatatjahu magicmatatjahu commented Jun 11, 2021

Description

Use production version of react/jsx-runtime to disable development warnings and also speed up the code. Change the react/jsx-runtime import to react/cjs/react-jsx-runtime.production.min in transpiled bundle.

How to test (in easiest way):

  • link or install locally this package from my PR in @asyncapi/generator package
  • test @asyncapi/markdown-template template and you shouldn't see any warnings related to key props.

Related issue(s)
Resolves #37

@magicmatatjahu magicmatatjahu added the enhancement New feature or request label Jun 11, 2021
@sonarcloud
Copy link

sonarcloud bot commented Jun 11, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@magicmatatjahu
Copy link
Member Author

@jonaslagoni You had right (in one of the issue comments) with production version of react :) Thanks!

@jonaslagoni
Copy link
Member

jonaslagoni commented Jun 11, 2021

@jonaslagoni You had right (in one of the issue comments) with production version of react :) Thanks!

@magicmatatjahu would there be any use-case where we would not want to use the production version? 🤔

Thinking about in development, anything production lib makes difficult?

@magicmatatjahu
Copy link
Member Author

magicmatatjahu commented Jun 11, 2021

@magicmatatjahu would there be any use-case where we would not want to use the production version? 🤔

Thinking about in development, anything production lib makes difficult?

I thought about that, but react only make warns for internal props like key which for us isn't needed and ref which doesn't work properly due to fact that we don't handle dynamic component, but only render component to string, so this prop is unnecessary.

@magicmatatjahu
Copy link
Member Author

magicmatatjahu commented Jun 11, 2021

@jonaslagoni We can make two separate compilation process for dev and prod and integrate it with generator with flag --compile=prod|dev, but only when community will raise that issue :)

@jonaslagoni
Copy link
Member

@jonaslagoni We can make two separate compilation process for dev and prod and integrate it with generator with flag --compile=prod|dev, but only when community will raise that issue :)

As long as adding this production dependency does not suddenly hide warnings and problems that make the development of templates harder we should be good 👍

@magicmatatjahu
Copy link
Member Author

The warnings will be hidden, but they don't matter to us because they are used only for dynamic components that may change in runtime, eg in html app :) I also checked the markdown-template by adding a few bug and we have an error trace due to the source-map, so it's not bad :) Errors will still appear from jsx-runtime but we only hide warnings :)

@magicmatatjahu magicmatatjahu merged commit 97eee22 into asyncapi:master Jun 11, 2021
@magicmatatjahu magicmatatjahu deleted the use-prod-jsxFactory branch June 11, 2021 11:40
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.2.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

react warnings are loud when generating react templates
3 participants