-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
with-reasonml: use default exports #4217
with-reasonml: use default exports #4217
Conversation
"dev": "concurrently \"bsb -clean-world -make-world -w\" \"next -w\"", | ||
"build": "bsb -clean-world -make-world && next build", | ||
"start": "bsb -clean-world -make-world && next start -w" | ||
"dev": "bsb -clean-world -make-world && next dev lib/js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should actually use https://github.com/reasonml-community/bs-loader 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably could. I'm experimenting with that separately right now actually.
Don't think it's necessary for this PR tho. Already a nice incremental improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not bs-loader exactly, since it's deprecated, but a similarly smoother set up here could work, that is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah definitely 👍
Looks good to me |
Hi @rase- Thanks for working on improving the Quick question... with the new pattern from this PR are you able to call import { jsComponent as About } from "./About.re";
About.getInitialProps = async (context) => {
// code here
};
export default () => <About /> It is good to be able to avoid the extra .js file if possible with your change but not sure how to call |
@tmepple Sure, you just have to do a little bit of hackery, similarly to how you'd have to do it with the separate JS file. Here's a quick example of how you could go about it (as a diff to the About page):
That said, I'm trying to explore some ways of doing this in a cleaner way as a wrapper on top of ReasonReact or additional next.js configuration which I'll share when I get there. In the meantime, the above is a similar trick to injecting to the imported component class in the JS file. |
I felt like there was a way to use the |
Here is a suggestion for the ReasonML example to remove the js files for pages, which basically just wrap a default export.
ReasonML enables ES6 default exports so that's done here, but this way we have to use the lib/js directory the bucklescript compiler targets. I think it's a very acceptable tradeoff in this example.