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

Commit

Permalink
fix(webpack): fixes bugs where some third party libs didn't load corr…
Browse files Browse the repository at this point in the history
…ectly

fixes bug where some third party libs didn't load correctly
  • Loading branch information
danbucholtz committed Mar 30, 2017
1 parent 7109f89 commit e7559e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
22 changes: 20 additions & 2 deletions src/webpack/ionic-environment-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { join } from 'path';
import { getParsedDeepLinkConfig } from '../util/helpers';
import { BuildContext , DeepLinkConfigEntry} from '../util/interfaces';
import { Logger } from '../logger/logger';
import { getInstance } from '../util/hybrid-file-system-factory';
import { createResolveDependenciesFromContextMap } from './util';
import { WatchMemorySystem } from './watch-memory-system';

import * as ContextElementDependency from 'webpack/lib/dependencies/ContextElementDependency';

export class IonicEnvironmentPlugin {
constructor(private context: BuildContext) {
}
Expand All @@ -18,10 +20,26 @@ export class IonicEnvironmentPlugin {
if (!result) {
return callback();
}

const ngModuleLoaderDirectory = join('ionic-angular', 'util');
if (!result.resource.endsWith(ngModuleLoaderDirectory)) {
return callback(null, result);
}

result.resource = this.context.srcDir;
result.recursive = true;
result.dependencies.forEach((dependency: any) => dependency.critical = false);
result.resolveDependencies = createResolveDependenciesFromContextMap((_: any, cb: any) => cb(null, webpackDeepLinkModuleDictionary));
result.resolveDependencies = (p1: any, p2: any, p3: any, p4: RegExp, cb: any ) => {
const dependencies = Object.keys(webpackDeepLinkModuleDictionary)
.map((key) => {
const value = webpackDeepLinkModuleDictionary[key];
if (value) {
return new ContextElementDependency(value, key);
}
return null;
}).filter(dependency => !!dependency);
cb(null, dependencies);
};
return callback(null, result);
});
});
Expand Down
16 changes: 0 additions & 16 deletions src/webpack/util.ts

This file was deleted.

0 comments on commit e7559e5

Please sign in to comment.