docs(aot-cb):bundle in-mem-web-api with esm and umd (#2617)

s

s
This commit is contained in:
Torgeir Helgevold 2016-10-20 00:52:32 -04:00 committed by Ward Bell
parent 1fe6434b94
commit 3eb7a41602
9 changed files with 13 additions and 32 deletions

View File

@ -26,7 +26,7 @@
// other libraries // other libraries
'rxjs': 'npm:rxjs', 'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api', 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
}, },
// packages tells the System loader how to load when no filename and/or no extension // packages tells the System loader how to load when no filename and/or no extension
packages: { packages: {
@ -36,10 +36,6 @@
}, },
rxjs: { rxjs: {
defaultExtension: 'js' defaultExtension: 'js'
},
'angular-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
} }
} }
}); });

View File

@ -51,7 +51,7 @@
// other libraries // other libraries
'rxjs': 'npm:rxjs', 'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api', 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@4.0.10/lib/plugin.js', 'ts': 'npm:plugin-typescript@4.0.10/lib/plugin.js',
'typescript': 'npm:typescript@2.0.2/lib/typescript.js', 'typescript': 'npm:typescript@2.0.2/lib/typescript.js',
@ -64,10 +64,6 @@
}, },
rxjs: { rxjs: {
defaultExtension: 'js' defaultExtension: 'js'
},
'angular-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
} }
} }
}); });

View File

@ -38,7 +38,7 @@
// other libraries // other libraries
'rxjs': 'npm:rxjs', 'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api', 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@4.0.10/lib/plugin.js', 'ts': 'npm:plugin-typescript@4.0.10/lib/plugin.js',
'typescript': 'npm:typescript@2.0.2/lib/typescript.js', 'typescript': 'npm:typescript@2.0.2/lib/typescript.js',
@ -51,10 +51,6 @@
}, },
rxjs: { rxjs: {
defaultExtension: 'js' defaultExtension: 'js'
},
'angular-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
} }
} }
}); });

View File

@ -6,6 +6,8 @@
<title>Angular Tour of Heroes</title> <title>Angular Tour of Heroes</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<script src="shim.min.js"></script> <script src="shim.min.js"></script>
<script src="zone.min.js"></script> <script src="zone.min.js"></script>
<!-- #docregion moduleId --> <!-- #docregion moduleId -->

View File

@ -14,7 +14,7 @@ import { AppRoutingModule } from './app-routing.module';
// #enddocregion v1 // #enddocregion v1
// Imports for loading & configuring the in-memory web api // Imports for loading & configuring the in-memory web api
import { InMemoryWebApiModule } from 'angular-in-memory-web-api/in-memory-web-api.module'; import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
import { InMemoryDataService } from './in-memory-data.service'; import { InMemoryDataService } from './in-memory-data.service';
// #docregion v1 // #docregion v1

View File

@ -2,7 +2,8 @@
var fs = require('fs'); var fs = require('fs');
var resources = [ var resources = [
'node_modules/core-js/client/shim.min.js', 'node_modules/core-js/client/shim.min.js',
'node_modules/zone.js/dist/zone.min.js' 'node_modules/zone.js/dist/zone.min.js',
'styles.css'
]; ];
resources.map(function(f) { resources.map(function(f) {
var path = f.split('/'); var path = f.split('/');

View File

@ -14,10 +14,7 @@ export default {
plugins: [ plugins: [
nodeResolve({jsnext: true, module: true}), nodeResolve({jsnext: true, module: true}),
commonjs({ commonjs({
include: [ include: ['node_modules/rxjs/**']
'node_modules/rxjs/**',
'node_modules/angular-in-memory-web-api/**'
],
}), }),
uglify() uglify()
] ]

View File

@ -401,13 +401,6 @@ a#toh
Rollup does the Tree Shaking as before. Rollup does the Tree Shaking as before.
The Rollup configuration changes slightly to accommodate the `angular-in-memory-web-api` module
that the _Tour of Heroes_ app requires for data server simulation.
The `angular-in-memory-web-api` is a `commonjs` module like the RxJS library.
Add `angular-in-memory-web-api` to the _commonjs plugin_ `include` array,
next to the `rxjs` file specification.
+makeExample('toh-6/ts/rollup-config.js',null,'rollup-config.js')(format='.') +makeExample('toh-6/ts/rollup-config.js',null,'rollup-config.js')(format='.')
:marked :marked

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 KiB

After

Width:  |  Height:  |  Size: 320 KiB