File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,16 +13,12 @@ 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- ) ;
2016 await writeFile (
2117 path . join ( cwd , 'app.tsx' ) ,
2218 `
2319 import { renderToString } from '@solidjs/web';
24- import { Title } from './Title.tsx ';
25- export const html: string = renderToString(() => <Title / >);
20+ const title: string = 'Hello ';
21+ export const html = renderToString(() => <h1>{title}</h1 >);
2622 ` ,
2723 ) ;
2824 await new Promise < void > ( ( resolve , reject ) => {
@@ -50,11 +46,7 @@ for (const compiler of ['native', 'babel']) {
5046 } ,
5147 {
5248 loader : 'solid-loader' ,
53- options : {
54- compiler,
55- scriptRegex : / \. t s x $ / g,
56- solid : { generate : 'ssr' } ,
57- } ,
49+ options : { compiler, solid : { generate : 'ssr' } } ,
5850 } ,
5951 ] ,
6052 } ,
Original file line number Diff line number Diff line change 1+ import { mkdtemp , rm , writeFile } from 'node:fs/promises' ;
2+ import path from 'node:path' ;
3+ import { promisify } from 'node:util' ;
4+ import { rspack } from '@rspack/core' ;
5+ import { expect , test } from '@rstest/playwright' ;
6+
7+ test ( 'compiles consecutive JSX files with a global scriptRegex' , async ( ) => {
8+ const playground = path . resolve ( import . meta. dirname , '../../playground' ) ;
9+ const cwd = await mkdtemp ( path . join ( playground , 'test-temp-' ) ) ;
10+ try {
11+ await writeFile (
12+ path . join ( cwd , 'app.jsx' ) ,
13+ "import './view.jsx'; export default <main />;" ,
14+ ) ;
15+ await writeFile ( path . join ( cwd , 'view.jsx' ) , 'export default <p />;' ) ;
16+
17+ const stats = await promisify ( rspack ) ( {
18+ context : cwd ,
19+ mode : 'development' ,
20+ entry : './app.jsx' ,
21+ output : { path : cwd } ,
22+ module : {
23+ rules : [
24+ {
25+ test : / \. j s x $ / ,
26+ loader : 'solid-loader' ,
27+ options : { scriptRegex : / \. j s x $ / g } ,
28+ } ,
29+ ] ,
30+ } ,
31+ } ) ;
32+ expect ( stats ?. toJson ( { all : false , errors : true } ) . errors ) . toEqual ( [ ] ) ;
33+ } finally {
34+ await rm ( cwd , { recursive : true , force : true } ) ;
35+ }
36+ } ) ;
You can’t perform that action at this time.
0 commit comments