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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment: TypeScript and JSX Support 馃椏 #103

Open
nomi-san opened this issue Dec 28, 2023 · 0 comments
Open

Experiment: TypeScript and JSX Support 馃椏 #103

nomi-san opened this issue Dec 28, 2023 · 0 comments
Labels
enhancement New feature or request idea Suggest or ideas for new features

Comments

@nomi-san
Copy link
Member

There are two transpilers could be used to transpile TS code within the browser.

Sucrase is blazing fast and commonly is used to replace ts-node for nodejs runtime, it just transpiles your code into JS and ignores all types (alse does type checks). Sucrase is built without nodejs deps, that means it should work fine in browser env.

plugins/
  |__plugin-1/
    |__index.ts  馃憟 entry
    |__.cache     ? cache transpiled if needed

How about import and ESM?

We already have CSS modules, so TS module is not impossible. That's actually what Vite did in dev mode. But there will have some troubles with named exports.

graph LR
A[index.ts] --> B["assets handler"] --> C["module [JS code]"]

How about JSX?

If you take Deno long enough, you will see that the code below is pretty familiar.

import { h, render } from 'https://esm.sh/[email protected]'

export function load() {
  const root = /*...*/
  render(root, () => <div>Some text</div>)
}
@nomi-san nomi-san added enhancement New feature or request idea Suggest or ideas for new features labels Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request idea Suggest or ideas for new features
Projects
None yet
Development

No branches or pull requests

1 participant