angular-docs-cn/modules/playground/systemjs-config.js
Paul Gschwendtner e4fb93c28a build: switch playground examples to bazel (#28490)
Currently all playground examples are built with `tsc`
and served with the `gulp serve` task. In order to be able
to test these examples easily with Ivy, we now build and
serve the examples using Bazel. This allows us to expand our
Ivy test coverage and additionally it allows us to move forward
with the overall Bazel migration. Building & serving individual
examples is now very easy and doesn't involve building everything
inside of `/modules`.

PR Close #28490
2019-02-04 16:51:11 -05:00

50 lines
1.3 KiB
JavaScript

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Normally the Bazel "ts_devserver" automatically handles the module resolution of
// dependencies in the browser using RequireJS, but there are various examples that
// use SystemJS (e.g. for lazy loading, web workers) and therefore we want to avoid
// repeating the basic configuration by providing this as a general SystemJS config.
const angularPackages = [
'common',
'animations',
'platform-browser/animations',
'compiler',
'core',
'forms',
'http',
'platform-browser',
'platform-browser-dynamic',
'platform-webworker',
'platform-webworker-dynamic',
'router',
'upgrade',
'upgrade/static',
];
const packagesConfig = {};
const mapConfig = {
'tslib': 'ngdeps/node_modules/tslib/tslib.js',
'rxjs': 'ngdeps/node_modules/rxjs/bundles/rxjs.umd.js',
'rxjs/operators': 'angular/modules/playground/systemjs-rxjs-operators.js',
};
angularPackages.forEach(pkgName => {
mapConfig[`@angular/${pkgName}`] = `angular/packages/${pkgName}`;
packagesConfig[`@angular/${pkgName}`] = {
main: 'index.js',
defaultExtension: 'js',
};
});
System.config({
map: mapConfig,
packages: packagesConfig,
});