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] Supports jsx file extensions #356

Closed
3 tasks done
pd4d10 opened this issue Dec 28, 2022 · 4 comments · Fixed by #363
Closed
3 tasks done

[RFC] Supports jsx file extensions #356

pd4d10 opened this issue Dec 28, 2022 · 4 comments · Fixed by #363
Labels
enhancement New feature or request

Comments

@pd4d10
Copy link
Contributor

pd4d10 commented Dec 28, 2022

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

Currently, background.ts, content.tsx and popup.tsx are the name conventions to create different type of pages. It would be great to also support background.js, content.js and popup.js.

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

To support dev languages other than TypeScript, for example Flow or ReScript

(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 pd4d10 added the enhancement New feature or request label Dec 28, 2022
@louisgv
Copy link
Contributor

louisgv commented Dec 28, 2022

Thanks for the RFC! Would you like to spearhead this initiative? @pd4d10

@louisgv louisgv changed the title [RFC] Consider supporting js file extensions [RFC] Supports js file extensions Dec 28, 2022
@pd4d10
Copy link
Contributor Author

pd4d10 commented Dec 29, 2022

Sure, I'll try to look into it

@louisgv
Copy link
Contributor

louisgv commented Dec 29, 2022

A couple challenges on top of my mind:

  • We will need to make sure the file extension auto-resolver for each ui library can recognize js files
  • We need to handle .js extension file generation. If we can be smart about how we handle the file path, we can just pass the path directly into the import statement?

Technically... you can just use Rescript or Flow in a separate bundling process and import your files into an entry file within Plasmo. It's an extra build step but it will allow you to use js/whatever you like in your extension. The key part that need to be ts and tsx are really the entry files. Try it out - you can import .js file in those entry files.

pd4d10 added a commit to pd4d10/plasmo that referenced this issue Dec 29, 2022
@louisgv louisgv changed the title [RFC] Supports js file extensions [RFC] Supports jsx file extensions Dec 30, 2022
@louisgv louisgv mentioned this issue Dec 30, 2022
3 tasks
@louisgv
Copy link
Contributor

louisgv commented Dec 30, 2022

So a quick note from #363 - js extension doesn't work since we want to leverage the use UI libraries. jsx extension makes more sense since it indicate the use of template syntax.

For ReScript, see #367

louisgv added a commit that referenced this issue Dec 30, 2022
* feat: supports js extension for react and vanilla ui

closes #356

* Adding jsx

* use jsx instead of js

Co-authored-by: L <[email protected]>
@pd4d10 pd4d10 mentioned this issue Dec 31, 2022
3 tasks
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

Successfully merging a pull request may close this issue.

2 participants