-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Usage question: where should the plugin be put in the configuration? #5
Comments
It honestly can be put in either way, but I would recommend it putting before the JSX transform happens. |
There is a babel plugin // In
const Hr = () => {
return <hr className="hr" />;
};
const WithChildren = (props) => {
return <div className={props.className}>
<hr />
</div>;
}
// out
var _hr, _hr2;
const Hr = () => {
return _hr || (_hr = <hr className="hr" />);
};
const WithChildren = (props) => {
return <div className={props.className}>
{_hr2 || (_hr2 = <hr />)}
</div>;
} I am wondering if by putting the forgetti after the JSX transform, is it possible to achieve the same result (caching |
It can cache either JSX itself or the transforms, which is why it doesn't matter. |
Thanks!
So is there any reason for that? |
because some frameworks handles the JSX transform itself that it isn't really the same as the normal JSX. Million is a good example. Forgetti must know not to touch the JSX unless the preset says so. A post-transform JSX from Forgetti might also be illegal for the framework using it. |
In my
forgetti-loader
's README, I mention thatforgetti-loader
should be put in a way thatforgetti
is executed before JSX transformation. But I am wondering if it is correct or not.The text was updated successfully, but these errors were encountered: