1+ import { join } from 'path' ;
12import { getParsedDeepLinkConfig } from '../util/helpers' ;
23import { BuildContext , DeepLinkConfigEntry } from '../util/interfaces' ;
34import { Logger } from '../logger/logger' ;
45import { getInstance } from '../util/hybrid-file-system-factory' ;
5- import { createResolveDependenciesFromContextMap } from './util' ;
66import { WatchMemorySystem } from './watch-memory-system' ;
77
8+ import * as ContextElementDependency from 'webpack/lib/dependencies/ContextElementDependency' ;
9+
810export class IonicEnvironmentPlugin {
911 constructor ( private context : BuildContext ) {
1012 }
@@ -18,10 +20,26 @@ export class IonicEnvironmentPlugin {
1820 if ( ! result ) {
1921 return callback ( ) ;
2022 }
23+
24+ const ngModuleLoaderDirectory = join ( 'ionic-angular' , 'util' ) ;
25+ if ( ! result . resource . endsWith ( ngModuleLoaderDirectory ) ) {
26+ return callback ( null , result ) ;
27+ }
28+
2129 result . resource = this . context . srcDir ;
2230 result . recursive = true ;
2331 result . dependencies . forEach ( ( dependency : any ) => dependency . critical = false ) ;
24- result . resolveDependencies = createResolveDependenciesFromContextMap ( ( _ : any , cb : any ) => cb ( null , webpackDeepLinkModuleDictionary ) ) ;
32+ result . resolveDependencies = ( p1 : any , p2 : any , p3 : any , p4 : RegExp , cb : any ) => {
33+ const dependencies = Object . keys ( webpackDeepLinkModuleDictionary )
34+ . map ( ( key ) => {
35+ const value = webpackDeepLinkModuleDictionary [ key ] ;
36+ if ( value ) {
37+ return new ContextElementDependency ( value , key ) ;
38+ }
39+ return null ;
40+ } ) . filter ( dependency => ! ! dependency ) ;
41+ cb ( null , dependencies ) ;
42+ } ;
2543 return callback ( null , result ) ;
2644 } ) ;
2745 } ) ;
0 commit comments