-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Support data-native-module="true" to generate native <script type="module"> #11437
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.
ah didn't know about "native-module" - makes sense with linked PR
I'd like to discuss about this a bit more. I think that a |
|
I proposed
|
Good point. I guess |
If you want to use your browser's native ES module support, the <script> tag needs to have a type="module" attribute. Now, babel standalone can generate native module scripts with <script type="text/babel" data-type="module"> ``` <!doctype html> <html> <head> <title>Babel Test</title> </head> <body> <script src="./babel.js"></script> <script type="text/babel" data-presets="react" data-type="module"> /** @jsx h */ import { h, render } from 'https://unpkg.com/preact?module'; render(<h1>Hello World!</h1>, document.body); </script> </body> </html> ```
a475606
to
a7d3877
Compare
If you want to use your browser's native ES module support, the
<script>
tag needs to have atype="module"
attribute. Now, babel standalone can generate native module scripts with<script type="text/babel" data-native-module="true">