File tree Expand file tree Collapse file tree 3 files changed +27
-15
lines changed
Expand file tree Collapse file tree 3 files changed +27
-15
lines changed Original file line number Diff line number Diff line change 11const mod = require ( "../dist/cjs/index.js" ) ;
22const { TypeScriptLoader } = mod ;
33TypeScriptLoader ( ) ;
4+
5+ console . info ( "Loaded with CJS successfully" ) ;
Original file line number Diff line number Diff line change 11import mod from "../dist/cjs/index.js" ;
2- const { TypeScriptLoader} = mod ;
3- TypeScriptLoader ( )
2+ const { TypeScriptLoader } = mod ;
3+ TypeScriptLoader ( ) ;
4+
5+ console . info ( "Loaded with ESM successfully" ) ;
Original file line number Diff line number Diff line change 11const assert = require ( "node:assert" ) ;
22
3- async function main ( ) {
4- const esm = await import ( "./dist/cjs/index.js" ) ;
5- const cjs = require ( "./dist/cjs/index.js" ) ;
3+ ( async ( ) => {
4+ try {
5+ const esm = await import ( "../dist/cjs/index.js" ) ;
6+ const cjs = require ( "../dist/cjs/index.js" ) ;
67
7- assert . equal (
8- esm . TypeScriptLoader ,
9- cjs . TypeScriptLoader ,
10- "esm.TypeScriptLoader === cjs.TypeScriptLoader"
11- ) ;
8+ assert . strictEqual (
9+ esm . TypeScriptLoader ,
10+ cjs . TypeScriptLoader ,
11+ "esm.TypeScriptLoader === cjs.TypeScriptLoader"
12+ ) ;
1213
13- // try to create loaders
14- esm . TypeScriptLoader ( ) ;
15- cjs . TypeScriptLoader ( ) ;
16- }
14+ // try to create loaders
15+ esm . TypeScriptLoader ( ) ;
16+ cjs . TypeScriptLoader ( ) ;
1717
18- main ( ) ;
18+ console . info ( "Loaded with both CJS and ESM successfully" ) ;
19+ } catch ( error ) {
20+ console . error ( error ) ;
21+ console . debug ( error . stack ) ;
22+
23+ // Prevent an unhandled rejection, exit gracefully.
24+ process . exit ( 1 ) ;
25+ }
26+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments