javascript - Angular 2.0.0 with angular-cli 1.0.0-beta.15: using typescript, how to integrate external libraries as in previous versions -
i'm creating application using angular 2
. started using in rc2 phase , after alot of updates made app according released rc got run on angular 2.0.0
final version.
as i'm using angular-cli
, updated latest version (1.0.0-beta.15
). did required changes needed e.g. uses webpack instead of systemjs.
my problem is, can't seem find way include external libraries (lets take jquery example) application without need include cdn.
in previous versions of angular 2
there angular-cli-build.js
this:
var angular2app = require('angular-cli/lib/broccoli/angular2-app'); module.exports = function(defaults) { return new angular2app(defaults, { vendornpmfiles: [ 'systemjs/dist/system-polyfills.js', 'systemjs/dist/system.src.js', 'zone.js/dist/**/*.+(js|js.map)', 'es6-shim/es6-shim.js', 'reflect-metadata/**/*.+(js|js.map)', 'rxjs/**/*.+(js|js.map)', '@angular/**/*.+(js|js.map)', 'jquery/dist/*.min.+(js|map)' ] }); };
which (looking last line of vendornpmfiles
array) mapped jquery library folder of ready build app system-config.js
had little this:
/** map relative paths urls. */ const map: = { 'jquery': 'vendor/jquery' };
and did creating vendor folder inside final build folder (by default called dist
) import jquery in parent index.html
statement like:
<script src="vendor/jquery/dist/jquery.min.js"></script>
my question how similar result described in angular-cli
version i'm using.
for use libraries globally include them in angular-cli.json
"apps": [ { "root": "src", "outdir": "dist", "assets": "assets", "index": "index.html", "main": "main.ts", "test": "test.ts", "tsconfig": "tsconfig.json", "prefix": "app", "mobile": false, "styles": [ "styles.css", "../node_modules/bootstrap/dist/css/bootstrap.min.css", "../node_modules/font-awesome/css/font-awesome.min.css" ], "scripts": [ "../node_modules/jquery/dist/jquery.min.js", "../node_modules/bootstrap/dist/js/bootstrap.min.js" ], "environments": { "source": "environments/environment.ts", "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" } } ],
this way not needed include them index.html. if finds way i'm still interested in it.
Comments
Post a Comment