File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ function render ( ) {
2
+ document . getElementById ( 'wrapper' ) . innerHTML = "<h1> Hello World!</h1>" ;
3
+ }
4
+
5
+ export = render ;
Original file line number Diff line number Diff line change @@ -601,6 +601,32 @@ module.exports = {
601
601
} ) ;
602
602
} ) ;
603
603
604
+ it ( 'When enabled, react JSX and TypeScript work nice together!' , ( done ) => {
605
+ const config = createWebpackConfig ( 'www/build' , 'dev' ) ;
606
+ config . setPublicPath ( '/build' ) ;
607
+ config . addEntry ( 'main' , [ './js/CoolReactComponent.jsx' , './js/render2.tsx' ] ) ;
608
+ config . enableReactPreset ( ) ;
609
+ config . configureTypeScript ( function ( tsConfig ) {
610
+ tsConfig . compilerOptions = { 'jsx' : 'preserve' } ;
611
+ } ) ;
612
+
613
+ testSetup . runWebpack ( config , ( webpackAssert ) => {
614
+ // check that babel transformed the JSX
615
+ webpackAssert . assertOutputFileContains (
616
+ 'main.js' ,
617
+ 'React.createElement'
618
+ ) ;
619
+
620
+ // and also ts-loader did its job
621
+ webpackAssert . assertOutputFileContains (
622
+ 'main.js' ,
623
+ 'document.getElementById(\'wrapper\').innerHTML = "<h1> Hello World!</h1>";'
624
+ ) ;
625
+
626
+ done ( ) ;
627
+ } ) ;
628
+ } ) ;
629
+
604
630
it ( 'The output directory is cleaned between builds' , ( done ) => {
605
631
const config = createWebpackConfig ( 'www/build' , 'dev' ) ;
606
632
config . setPublicPath ( '/build' ) ;
You can’t perform that action at this time.
0 commit comments