File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
packages/angular_devkit/build_angular/src/utils/server-rendering/esm-in-memory-loader Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 99import { join } from 'node:path' ;
1010import { pathToFileURL } from 'node:url' ;
1111import { workerData } from 'node:worker_threads' ;
12+ import { satisfies } from 'semver' ;
1213
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 ') ) ;
1617}
1718
1819/** Call the initialize hook when running on Node.js 18 */
1920export function callInitializeIfNeeded (
2021 initialize : ( typeof import ( './loader-hooks' ) ) [ 'initialize' ] ,
2122) : void {
22- if ( isNode18 ( ) ) {
23+ if ( ! supportsImportFlag ( ) ) {
2324 initialize ( workerData ) ;
2425 }
2526}
2627
2728export function getESMLoaderArgs ( ) : string [ ] {
28- if ( isNode18 ( ) ) {
29+ if ( ! supportsImportFlag ( ) ) {
2930 return [
3031 '--no-warnings' , // Suppress `ExperimentalWarning: Custom ESM Loaders is an experimental feature...`.
3132 '--loader' ,
You can’t perform that action at this time.
0 commit comments