0
嗯,我有一個奇怪的情況。我遵循了第三方lib安裝的所有指南。當我運行ng服務時,實際上我可以在dis/vendor/redux下看到該庫。但是,當我打開瀏覽器時,我的應用程序不工作,當我檢查開發人員工具中的資源時,庫不存在。我應該在哪裏尋找問題?我的意思是如何有可能在dist文件夾中,我可以看到圖書館(在webstorm中),但在瀏覽器上它不出現?Angular CLI第三方lib安裝失敗
// SystemJS configuration file, see links for more information
// https://github.com/systemjs/systemjs
// https://github.com/systemjs/systemjs/blob/master/docs/config-api.md
/***********************************************************************************************
* User Configuration.
**********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
'redux': 'vendor/redux/dist'
};
/** User packages configuration. */
const packages: any = {
'redux':{defaultExtension: 'js', main: 'redux.js'}
};
////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
* Everything underneath this line is managed by the CLI.
**********************************************************************************************/
const barrels: string[] = [
// Angular specific barrels.
'@angular/core',
'@angular/common',
'@angular/compiler',
'@angular/http',
'@angular/router',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router-deprecated',
// Thirdparty barrels.
'rxjs',
// App specific barrels.
'app',
'app/shared',
/** @cli-barrel */
];
const cliSystemConfigPackages: any = {};
barrels.forEach((barrelName: string) => {
cliSystemConfigPackages[barrelName] = { main: 'index' };
});
/** Type declaration for ambient System. */
declare var System: any;
// Apply the CLI SystemJS configuration.
System.config({
map: {
'@angular': 'vendor/@angular',
'rxjs': 'vendor/rxjs',
'main': 'main.js'
},
packages: cliSystemConfigPackages
});
// Apply the user's configuration.
System.config({ map, packages });
和角度-CLI-build.js:
// Angular-CLI build configuration
// This file lists all the node_modules files that will be used in a build
// Also see https://github.com/angular/angular-cli/wiki/3rd-party-libs
/* global require, module */
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/**/*.+(ts|js|js.map)',
'rxjs/**/*.+(js|js.map)',
'@angular/**/*.+(js|js.map)',
'redux/dist/**/*.js'
]
});
};
是'供應商/終極版/距離/ redux.js',也許你需要什麼格式添加'格式:「format_type」'包裝的定義? – Sasxa
你不應該需要'packages'定義。 – dmackerman