File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 11import { Plugin } from 'vite' ;
2- import solid from 'babel-preset-solid' ;
32import { transformAsync , TransformOptions } from '@babel/core' ;
43
54interface Options {
@@ -41,14 +40,13 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
4140 needHmr = config . command === 'serve' && ! config . isProduction ;
4241 } ,
4342
44- async transform ( source , id ) {
43+ async transform ( source , id , ssr ) {
4544 if ( ! / \. [ j t ] s x / . test ( id ) ) return null ;
4645
4746 let solidOptions : { generate : 'ssr' | 'dom' ; hydratable : boolean } ;
4847
4948 if ( options . ssr ) {
50- // This is a ugly hack that doesn't work really well..
51- if ( globalThis . _SOLID_SSR ) {
49+ if ( ssr ) {
5250 solidOptions = { generate : 'ssr' , hydratable : true } ;
5351 } else {
5452 solidOptions = { generate : 'dom' , hydratable : true } ;
@@ -59,7 +57,7 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
5957
6058 const opts : TransformOptions = {
6159 filename : id ,
62- presets : [ [ solid , solidOptions ] ] ,
60+ presets : [ [ require ( 'babel-preset- solid' ) , solidOptions ] ] ,
6361 } ;
6462
6563 if ( id . includes ( 'tsx' ) ) {
You can’t perform that action at this time.
0 commit comments