File tree 1 file changed +6
-5
lines changed
packages/angular_devkit/build_angular/src/utils/server-rendering/esm-in-memory-loader
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 9
9
import { join } from 'node:path' ;
10
10
import { pathToFileURL } from 'node:url' ;
11
11
import { workerData } from 'node:worker_threads' ;
12
+ import { satisfies } from 'semver' ;
12
13
13
- let IS_NODE_18 : boolean | undefined ;
14
- function isNode18 ( ) : boolean {
15
- return ( IS_NODE_18 ??= process . versions . node . startsWith ( ' 18.') ) ;
14
+ let SUPPORTS_IMPORT_FLAG : boolean | undefined ;
15
+ function supportsImportFlag ( ) : boolean {
16
+ return ( SUPPORTS_IMPORT_FLAG ??= satisfies ( process . versions . node , '>= 18.19 ') ) ;
16
17
}
17
18
18
19
/** Call the initialize hook when running on Node.js 18 */
19
20
export function callInitializeIfNeeded (
20
21
initialize : ( typeof import ( './loader-hooks' ) ) [ 'initialize' ] ,
21
22
) : void {
22
- if ( isNode18 ( ) ) {
23
+ if ( ! supportsImportFlag ( ) ) {
23
24
initialize ( workerData ) ;
24
25
}
25
26
}
26
27
27
28
export function getESMLoaderArgs ( ) : string [ ] {
28
- if ( isNode18 ( ) ) {
29
+ if ( ! supportsImportFlag ( ) ) {
29
30
return [
30
31
'--no-warnings' , // Suppress `ExperimentalWarning: Custom ESM Loaders is an experimental feature...`.
31
32
'--loader' ,
You can’t perform that action at this time.
0 commit comments