esm.sh icon indicating copy to clipboard operation
esm.sh copied to clipboard

`esm.sh` incorrectly transforms Solid JSX

Open LePichu opened this issue 2 years ago • 14 comments

Introduction

As Solid is far different than traditional JSX transformation, esm.sh produces very incorrect and React oriented JSX which can not be used in Solid even tho it's importing from Solid.

Result

An example of incorrect transformation: https://esm.sh/v102/@solidjs/[email protected]/deno/dist/index.jsx.development.js

Expected

What should happen is either it does not transform and return JSX or return an error that this module is not supported.

LePichu avatar Jan 11 '23 20:01 LePichu

@LePichu thanks, i will look into it

ije avatar Jan 11 '23 20:01 ije

if we just return the raw jsx, can it work in deno runtime?

ije avatar Jan 11 '23 20:01 ije

if we just return the raw jsx, can it work in deno runtime?

Deno can deal with JSX/TSX, but also the fact that most people will be using something like ESBuild and that will take care of building the final output from JSX.

LePichu avatar Jan 11 '23 20:01 LePichu

IMG_20230112_022802 Reconfirmation; but JSX works/runs out of box on Deno.

LePichu avatar Jan 11 '23 20:01 LePichu

Other question, how do you get the url https://esm.sh/v102/@solidjs/[email protected]/deno/dist/index.jsx.development.js ?

Screenshot 2023-01-12 at 04 58 42

ije avatar Jan 11 '23 20:01 ije

IMG_20230112_022802 Reconfirmation; but JSX works/runs out of box on Deno.

yeah i know deno supports jsx, but seems solidjs is using babel to do ATO transplile

ije avatar Jan 11 '23 21:01 ije

Other question, how do you get the url https://esm.sh/v102/@solidjs/[email protected]/deno/dist/index.jsx.development.js ?

Screenshot 2023-01-12 at 04 58 42

It uhh.....

Screenshot_2023-01-12-02-33-30-47_40deb401b9ffe8e1df2f1cc5ba480b12

LePichu avatar Jan 11 '23 21:01 LePichu

IMG_20230112_022802 Reconfirmation; but JSX works/runs out of box on Deno.

yeah i know deno supports jsx, but seems solidjs is using babel to do ATO transplile

Is it not possible to return Raw JSX? Just transpiling the TS part and keeping the JSX intact? There's an ESBuild plugin to handle Solid JSX Transforms tho which we use, not sure if that's helpful.

LePichu avatar Jan 11 '23 21:01 LePichu

There's an ESBuild plugin to handle Solid JSX Transforms tho which we use, not sure if that's helpful.

i think the plugin also uses babel too

ije avatar Jan 11 '23 21:01 ije

in fact you can get the raw jsx code via https://esm.sh/@solidjs/[email protected]/dist/index.jsx

ije avatar Jan 11 '23 21:01 ije

There's an ESBuild plugin to handle Solid JSX Transforms tho which we use, not sure if that's helpful.

i think the plugin also uses babel too

It does.

LePichu avatar Jan 11 '23 21:01 LePichu

in fact you can get the raw jsx code via https://esm.sh/@solidjs/[email protected]/dist/index.jsx

I'll try around with this, thanks!

LePichu avatar Jan 11 '23 21:01 LePichu

in fact you can get the raw jsx code via esm.sh/@solidjs/[email protected]/dist/index.jsx

~~This in deno doesn't return the raw JSX, but rather redirects to a precompiled version which uses React as a way to generate components~~

EDIT: entered the URL wrong, but it still doesnt work, due to the raw JSX having non-esm imports but rather nodeJS style imports image

Suya1671 avatar Jan 12 '23 15:01 Suya1671

@ije I think having something like allowing to use ESBuild plugins in esm.sh to transform JS flavors properly could work here and also fix issues with other frameworks if there are any.

LePichu avatar Jan 12 '23 18:01 LePichu