-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Create an option for a compiler #462
Comments
We need an option to swap Buble for anything, not for Babel. I will be happy to accept a pull request ;-) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I've stumbled upon https://github.com/lynaghk/babel/ and I think we could evaluate it at least. |
Keep in mind that you're quoting 2017 me, I've changed my opinion since then ;-) There's also https://github.com/alangpierce/sucrase that looks very promising and does exactly what we need to run examples in modern browsers including JSX, TypeScript, and Flow. It could be a good default instead of Buble. According to Bundlephobia it's 40 KB minified gzipped. We'll still need an option to change it to real Babel or TypeScript for folks who need it. |
Yeah I realize that just wanted to pin the link here so it's not lost. I'm really interested in a full-blown TS support in Styleguidist TBH so yeah, we need the parser to be a plugin. |
Has anyone done any work on this? I'd like to poke about with it. Pointers or suggestions would be great. |
I think @sapegin has a WIP branch already somewhere |
OK, I was just going to go with creating an IoC Dependency injected option to provide the transpiler in the config or use the current default if its not set. But if there's a WIP I'll just see what that looks like instead. |
I’m not 100% sure about that so you better look for it or wait for Artem’s answer |
@dweng0 yeah, it's done as part of #1553 but the whole branch is far from done, so feel free to extract it into a separate pull request so we can release it separately. It also changes the default compiler, which I think we should release as well with the new option, otherwise, transpiling imports would make the whole thing more complex than it should be. |
Cheers, I'll take a look and see if J can help out |
The pull request is here! |
1. Replace Bublé with Sucrase: faster, supports more ECMAScript features, like imports (we used to transpile them ourselves), optional chaining, class fields, etc. 2. Allow custom compilers, like Babel or TypeScript using the new compilerModule and compileExample option. Closes #462
I tested the alpha version in our react-components library and it works as expected 🎉 We've good some improvement! With
With
I guess the bottleneck it's in Thank you! |
If someone has a certain babel configuration and wants to use the same code in the styleguide readme, we need to enable swaping out buble for babel.
The text was updated successfully, but these errors were encountered: