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

[RFC] Support ReScript #367

Open
3 tasks done
louisgv opened this issue Dec 30, 2022 · 2 comments
Open
3 tasks done

[RFC] Support ReScript #367

louisgv opened this issue Dec 30, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@louisgv
Copy link
Contributor

louisgv commented Dec 30, 2022

How do you envision this feature/change to look/work like?

User can create UI component using the .res file extension, which get compiled using https://rescript-lang.org/

What is the purpose of this change/feature? Why?

Follow up on #356 - Some folks love ReScript it seems

(OPTIONAL) Example implementations

No response

(OPTIONAL) Contact Details

No response

Verify canary release

  • I verified that the issue exists in plasmo canary release

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@pd4d10
Copy link
Contributor

pd4d10 commented Dec 30, 2022

Thanks for the quick feedback!

Comment from #363 (comment)

@pd4d10 For rescript - you can create a rescript parcel transformer, that incorporates the .res file extension. We can incorporate it in our config and that will allow you to use the .res extension for rescript with zero external bundlings needed.

AFAIK, ReScript's build system may be a little different from common JS transformers like Babel. Instead of compiling files one by one, it seems treat all files (from its perspective, also modules) as a whole.

So I'm not sure if the "rescript parcel transformer" way would work

@louisgv
Copy link
Contributor Author

louisgv commented Dec 30, 2022

Thanks for the quick feedback!

Comment from #363 (comment)
@pd4d10 For rescript - you can create a rescript parcel transformer, that incorporates the .res file extension. We can incorporate it in our config and that will allow you to use the .res extension for rescript with zero external bundlings needed.

AFAIK, ReScript's build system may be a little different from common JS transformers like Babel. Instead of compiling files one by one, it seems treat all files (from its perspective, also modules) as a whole.

So I'm not sure if the "rescript parcel transformer" way would work

A parcel transformer basically takes a file and resolve any reference within it and turn them into an usable bundle (js/css)

Basically, a .res file can be transformed by rescript into .js, and any source referenced inside that rescript file can either be handled by the rescript transformer (to replace url reference), OR be handled by the rescript build system itself (basically you just add rescript into this transformer and it can do whatever it need to do).

The transformation step is handled by Rescript itself, and I imagine it can be configured to align with parcel or just do everything on its own.

@ColdSauce ColdSauce changed the title [RFC] Supports ReScript [RFC] Support ReScript Jan 2, 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
Projects
None yet
Development

No branches or pull requests

2 participants