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

(chore) Fix typescript type exports #3073

Merged
merged 1 commit into from
Apr 5, 2021

Conversation

joshgoebel
Copy link
Member

@joshgoebel joshgoebel commented Mar 25, 2021

Resolved #2945.

Changes

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

@joshgoebel joshgoebel added this to the 11.0 alpha 1 milestone Mar 28, 2021
@joshgoebel joshgoebel marked this pull request as draft April 5, 2021 03:30
@joshgoebel joshgoebel modified the milestones: 11.0 alpha 1, 10.7.3 Apr 5, 2021
@joshgoebel joshgoebel self-assigned this Apr 5, 2021
@joshgoebel joshgoebel marked this pull request as ready for review April 5, 2021 22:28
@joshgoebel joshgoebel force-pushed the typescript_exports branch from c158e5d to fee59ef Compare April 5, 2021 22:38
@joshgoebel joshgoebel merged commit 779be2b into highlightjs:main Apr 5, 2021
@Hypnosphi
Copy link

@joshgoebel can you please backport this into v10? I'd be happy to migrate to v11, but unfortunately I can't, because I use dynamic imports, see webpack/webpack#13865

@joshgoebel
Copy link
Member Author

V10.0 is about to drop off the supported list entirely. The core team really does not have time to support multiple versions. Even a PR here isn't super trivial as it would have to pull over the new changes but then also back out the changes to types that occurred between 10 -> 11.

but unfortunately I can't, because I use dynamic imports, see webpack/webpack#13865

import isn't the only way to use the library. You could use the stand-alone JS builds (as a separate file even) or even append our web build at the very end of your build process (I'm sure Webpack has a way of doing this). So there are ways to use v11 with Webpack despite the bug.

@joshgoebel
Copy link
Member Author

If the exports was a huge issue we might perhaps drop them entirely, but it seems only a few broken tools are having issues and that mostly everything else works - unless others would like to chime in here.

@Hypnosphi
Copy link

More context: we're developing a component library, and our Code component loads languages on demand in runtime depending on the passed language prop value. How would I do that without using dynamic imports or migrating away from webpack?

Source: https://github.com/JetBrains/ring-ui/blob/typescript/components/code/code.tsx#L15-L21

@joshgoebel
Copy link
Member Author

joshgoebel commented Sep 4, 2021

Well, I'm not a webpack person I have no idea what the magic comment is trying to do but I'd imagine for dynamic run-time dependencies (via import) you would just use the new ESM CDN builds that we publish (as of 11.2) unmodified... the grammars are all package up in individual files for dynamic usage... and the "main" Highlight.js bundle could be:

  • loaded separately via <script>
  • concated to the end of your webpack build (surely there exists a web pack plugin to do this)
  • imported dynamically as well (via ESM CDN build)

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.

[Request] Expose TypeScript types.
2 participants