Skip to content

Conversation

@ryan-roemer
Copy link
Member

@ryan-roemer ryan-roemer commented May 16, 2023

Hey! What do you know? importmaps now mostly work! Which means we can update our browser one-page version to use just ESM.

Fixes:

  • Allow more tolerant react-syntax-highligher import behavior to better accommodate both CJS and ESM.

Notes:

  • No more UMD needed! 🎉
  • BUT, first load if not cached is 2010-era requirejs-in-dev-mode slow! 🐢
  • react* libs of course don't have ESM versions. And lots of other libraries don't play nice. So instead we use esm.sh which adjusts for ESM things
  • We have to manually override react to 18 (since some transitive deps bring in 17)

Future notes:

  • If this works we'll want to ticket out (1) removing UMD and (2) a major release.

@vercel
Copy link

vercel bot commented May 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
spectacle-docs-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2023 11:51pm

@ryan-roemer ryan-roemer changed the title [WIP] One-page: Pure ESM One-page: Pure ESM May 16, 2023
@ryan-roemer ryan-roemer marked this pull request as ready for review May 16, 2023 23:49
@ryan-roemer
Copy link
Member Author

STATUS: Hold up. Something's rebroken with that prism import...

@ryan-roemer
Copy link
Member Author

Oh, haha -- we need to publish my fix first for a preview to work. All good to review @carloskelly13 @gksander !

@carloskelly13
Copy link
Contributor

Hitting the local mjs build reveals your theme fix works!

image

Copy link
Contributor

@carloskelly13 carloskelly13 left a comment

Choose a reason for hiding this comment

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

This is great. We're going to have to keep the React versions inline. I wonder if a future version can fill in a unified React version number for both the import, React DOM, and all the libraries that do a dep on it.

@ryan-roemer ryan-roemer merged commit e0a9811 into main May 17, 2023
@ryan-roemer ryan-roemer deleted the experiment/one-page-esm branch May 17, 2023 14:43
@github-actions github-actions bot mentioned this pull request May 17, 2023
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