Skip to content

Commit

Permalink
fix(@angular/cli): support rxjs 5.5 path alias
Browse files Browse the repository at this point in the history
Blocked by an answer to ReactiveX/rxjs#2979.

Fix angular#8096
  • Loading branch information
filipesilva authored and hansl committed Oct 19, 2017
1 parent 5614fd1 commit 3dacf17
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/@angular/cli/models/webpack-configs/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { NamedLazyChunksWebpackPlugin } from '../../plugins/named-lazy-chunks-we
import { InsertConcatAssetsWebpackPlugin } from '../../plugins/insert-concat-assets-webpack-plugin';
import { extraEntryParser, getOutputHashFormat, AssetPattern } from './utils';
import { isDirectory } from '../../utilities/is-directory';
import { requireProjectModule } from '../../utilities/require-project-module';
import { WebpackConfigOptions } from '../webpack-config';

const ConcatPlugin = require('webpack-concat-plugin');
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const SilentError = require('silent-error');


/**
* Enumerate loaders and their dependencies from this file to let the dependency validator
* know they are used.
Expand Down Expand Up @@ -157,11 +157,23 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
extraPlugins.push(new NamedLazyChunksWebpackPlugin());
}

// Read the tsconfig to determine if we should prefer ES2015 modules.

// Load rxjs path aliases.
// https://github.com/ReactiveX/rxjs/blob/master/doc/lettable-operators.md#build-and-treeshaking
let alias = {};
try {
const rxjsPathMappingImport = 'rxjs/_esm5/path-mapping';
const rxPaths = requireProjectModule(projectRoot, rxjsPathMappingImport);
alias = rxPaths(nodeModules);
} catch (e) { }

return {
resolve: {
extensions: ['.ts', '.js'],
modules: ['node_modules', nodeModules],
symlinks: !buildOptions.preserveSymlinks
symlinks: !buildOptions.preserveSymlinks,
alias
},
resolveLoader: {
modules: [nodeModules, 'node_modules']
Expand Down

0 comments on commit 3dacf17

Please sign in to comment.