File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1- #!/usr/bin/env node --enable-source-maps
1+ #!/usr/bin/env node
22/* eslint-disable @typescript-eslint/ban-ts-comment */
33// @ts -nocheck
44
5+ // Both source map APIs are marked experimental as of Aug 8 2025, so we use dynamic checks
6+ // instead of calling them unconditionally to avoid crashes on unsupported Node.js versions.
7+ // Prefer the recommended module.setSourceMapsSupport() API for newer Node versions (Node.js 23.7.0+, 22.14.0+)
8+ // Fall back to process.setSourceMapsEnabled() for older Node versions (Node.js 16.6.0+, 14.18.0+)
9+ if ( typeof module . setSourceMapsSupport === 'function' ) {
10+ module . setSourceMapsSupport ( { nodeModules : true , generatedCode : true } ) ;
11+ } else if ( typeof process . setSourceMapsEnabled === 'function' ) {
12+ process . setSourceMapsEnabled ( true ) ;
13+ } else {
14+ // Check if source maps are already enabled via NODE_OPTIONS
15+ const nodeOptions = process . env . NODE_OPTIONS || '' ;
16+ if ( ! nodeOptions . includes ( '--enable-source-maps' ) ) {
17+ if ( nodeOptions ) {
18+ console . warn ( 'Source maps support not available. Consider adding --enable-source-maps to the existing NODE_OPTIONS environment variable.' ) ;
19+ } else {
20+ console . warn ( 'Source maps support not available. Consider setting the NODE_OPTIONS environment variable to "--enable-source-maps".' ) ;
21+ }
22+ }
23+ }
24+
525// Stash the base directory into a global variable.
626global . __rootDirectory = __dirname + '/dist/' ;
727
You can’t perform that action at this time.
0 commit comments