solidjs / vite-plugin-solid

A simple integration to run solid-js with vite
435 stars 51 forks source link

Remove `@babel/preset-typescript` #95

Open lxsmnsyc opened 1 year ago

lxsmnsyc commented 1 year ago
ryansolid commented 1 year ago

I didn't write this plugin so I can't speak to it. But assuming we don't do the TS conversion the expectation is the downstream tool does? Can we make that assumption. I'm open to this if we know Vite will just handle this for the files we process. I wonder if there are any other implications. I trust you if you've tested this.

lxsmnsyc commented 1 year ago

The transform step in the link I gave is actually based on what Prefresh does in their Vite plugin: https://github.com/preactjs/prefresh/blob/main/packages/vite/src/index.js#L27-L34

so if anything, they have tested this more realistically. It works as I've tested. My only concern really here is if anyone actually uses the typescript option in the plugin, in which case we can just recommend users to install @babel/preset-typescript on their own.

Eptagone commented 8 months ago

Hi. I actually use typescript option for this:

solid({
    typescript: {
        allowDeclareFields: true,
    },
})

Otherwise, my build fails because declare is not allowed without that setting

4:42:58 PM [vite] Internal server error: /home/eptadot/source/md-web-widgets-elec-2024/assets/stimulus/controllers/Form/CandidateCollectionController/index.tsx: The 'declare' modifier is only allowed when the 'allowDeclareFields' option of @babel/plugin-transform-typescript or @babel/preset-typescript is enabled.
  23 |      
> 24 |     declare readonly nameValue: string;

Can I use declare without that setting after removing @babel/preset-typescript? I suppose yes but I want to be sure.

lxsmnsyc commented 8 months ago

yes you can. The new setup just enables Babel to understand TypeScript syntax.