File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,10 @@ const solidLoader: LoaderDefinition<SolidLoaderOptions> = async function (
3333 const sourceFilename = this . resourcePath ;
3434 const resourceFilename = options . transformFilename ?? sourceFilename ;
3535
36- if ( options . scriptRegex && ! options . scriptRegex . test ( resourceFilename ) ) {
36+ if (
37+ options . scriptRegex &&
38+ resourceFilename . search ( options . scriptRegex ) === - 1
39+ ) {
3740 callback ( null , source , sourceMap ) ;
3841 return ;
3942 }
Original file line number Diff line number Diff line change @@ -13,12 +13,16 @@ for (const compiler of ['native', 'babel']) {
1313 test ( `renders typed SSR output with ${ compiler } ` , async ( ) => {
1414 const cwd = await mkdtemp ( path . join ( playground , 'test-temp-' ) ) ;
1515 try {
16+ await writeFile (
17+ path . join ( cwd , 'Title.tsx' ) ,
18+ 'export const Title = () => <h1>Hello</h1>;' ,
19+ ) ;
1620 await writeFile (
1721 path . join ( cwd , 'app.tsx' ) ,
1822 `
1923 import { renderToString } from '@solidjs/web';
20- const title: string = 'Hello ';
21- export const html = renderToString(() => <h1>{title}</h1 >);
24+ import { Title } from './Title.tsx ';
25+ export const html: string = renderToString(() => <Title / >);
2226 ` ,
2327 ) ;
2428 await new Promise < void > ( ( resolve , reject ) => {
@@ -46,7 +50,11 @@ for (const compiler of ['native', 'babel']) {
4650 } ,
4751 {
4852 loader : 'solid-loader' ,
49- options : { compiler, solid : { generate : 'ssr' } } ,
53+ options : {
54+ compiler,
55+ scriptRegex : / \. t s x $ / g,
56+ solid : { generate : 'ssr' } ,
57+ } ,
5058 } ,
5159 ] ,
5260 } ,
You can’t perform that action at this time.
0 commit comments