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

Support data-type="module" to generate native <script type="module"> #11466

Merged
merged 1 commit into from May 24, 2020

Conversation

dfabulich
Copy link
Contributor

@dfabulich dfabulich commented Apr 22, 2020

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>
Q                       A
Fixed Issues? Fixes #9448
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass?
Documentation PR Link babel/website#2236
Any Dependency Changes?
License MIT

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>
```
@dfabulich
Copy link
Contributor Author

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

@dfabulich
Copy link
Contributor Author

@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.

@existentialism
Copy link
Member

Weird that it auto closed it?

You can add the docs in a separate PR, they're in a separate repo anyway :)

@nicolo-ribaudo nicolo-ribaudo added pkg: standalone PR: New Feature 🚀 A type of pull request used for our changelog categories labels Apr 26, 2020
@nicolo-ribaudo nicolo-ribaudo added this to the v7.10.0 milestone Apr 26, 2020
@nicolo-ribaudo
Copy link
Member

@dfabulich Docs are in the https://github.com/babel/website repository.

I would love a revamp of the @babel/standalone docs 😁

@nicolo-ribaudo nicolo-ribaudo added the PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release label Apr 26, 2020
@dfabulich
Copy link
Contributor Author

What's the next step here?

@nicolo-ribaudo
Copy link
Member

We'll merge this when releasing the next minor (probably about in 2 weeks, but we haven't decided yet)!
In the meantime, could you open a PR to the babel/website repository with docs for this change?

@nicolo-ribaudo nicolo-ribaudo merged commit 8fce371 into babel:master May 24, 2020
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 24, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: standalone PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Babel-standalone with native ESM type="module" support
4 participants