@@ -5,14 +5,14 @@ import { NamedLazyChunksWebpackPlugin } from '../../plugins/named-lazy-chunks-we
55import { InsertConcatAssetsWebpackPlugin } from '../../plugins/insert-concat-assets-webpack-plugin' ;
66import { extraEntryParser , getOutputHashFormat , AssetPattern } from './utils' ;
77import { isDirectory } from '../../utilities/is-directory' ;
8+ import { requireProjectModule } from '../../utilities/require-project-module' ;
89import { WebpackConfigOptions } from '../webpack-config' ;
910
1011const ConcatPlugin = require ( 'webpack-concat-plugin' ) ;
1112const ProgressPlugin = require ( 'webpack/lib/ProgressPlugin' ) ;
1213const CircularDependencyPlugin = require ( 'circular-dependency-plugin' ) ;
1314const SilentError = require ( 'silent-error' ) ;
1415
15-
1616/**
1717 * Enumerate loaders and their dependencies from this file to let the dependency validator
1818 * know they are used.
@@ -157,11 +157,23 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
157157 extraPlugins . push ( new NamedLazyChunksWebpackPlugin ( ) ) ;
158158 }
159159
160+ // Read the tsconfig to determine if we should prefer ES2015 modules.
161+
162+ // Load rxjs path aliases.
163+ // https://github.com/ReactiveX/rxjs/blob/master/doc/lettable-operators.md#build-and-treeshaking
164+ let alias = { } ;
165+ try {
166+ const rxjsPathMappingImport = 'rxjs/_esm5/path-mapping' ;
167+ const rxPaths = requireProjectModule ( projectRoot , rxjsPathMappingImport ) ;
168+ alias = rxPaths ( nodeModules ) ;
169+ } catch ( e ) { }
170+
160171 return {
161172 resolve : {
162173 extensions : [ '.ts' , '.js' ] ,
163174 modules : [ 'node_modules' , nodeModules ] ,
164- symlinks : ! buildOptions . preserveSymlinks
175+ symlinks : ! buildOptions . preserveSymlinks ,
176+ alias
165177 } ,
166178 resolveLoader : {
167179 modules : [ nodeModules , 'node_modules' ]
0 commit comments