Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit e7559e5

Browse files
committed
fix(webpack): fixes bugs where some third party libs didn't load correctly
fixes bug where some third party libs didn't load correctly
1 parent 7109f89 commit e7559e5

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

src/webpack/ionic-environment-plugin.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import { join } from 'path';
12
import { getParsedDeepLinkConfig } from '../util/helpers';
23
import { BuildContext , DeepLinkConfigEntry} from '../util/interfaces';
34
import { Logger } from '../logger/logger';
45
import { getInstance } from '../util/hybrid-file-system-factory';
5-
import { createResolveDependenciesFromContextMap } from './util';
66
import { WatchMemorySystem } from './watch-memory-system';
77

8+
import * as ContextElementDependency from 'webpack/lib/dependencies/ContextElementDependency';
9+
810
export 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
});

src/webpack/util.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)