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-type="module" to generate native <script type="module"> #11466
Support data-type="module" to generate native <script type="module"> #11466
Conversation
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> ```
I did a force-push on my branch to incorporate feedback from PR #11437 and it auto-closed the PR (presumably to reset approvals?); I can't reopen it, so I've created a new PR. @hzoo @existentialism @nicolo-ribaudo |
@nicolo-ribaudo In PR #11437 you added the label "PR: Needs Docs" … do I need to add documentation to this PR in order to merge it? I'd like to do a big revamp of the docs at https://babeljs.io/docs/en/babel-standalone making it much clearer in general, but I'd prefer to do that in a separate PR, dependent on this PR. |
Weird that it auto closed it? You can add the docs in a separate PR, they're in a separate repo anyway :) |
@dfabulich Docs are in the https://github.com/babel/website repository. I would love a revamp of the |
What's the next step here? |
We'll merge this when releasing the next minor (probably about in 2 weeks, but we haven't decided yet)! |
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-type="module">