1
我正在與角2的應用程序,當我創建與AOT編譯束角度2文檔https://angular.io/docs/ts/latest/cookbook/aot-compiler.html中提到,它給人depenency錯誤,這裏是錯誤NG2的自舉依賴問題 - 角2
參見https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module AOT /應用/ app.module.ngfactory.js(700:23) 'ModalModule' 不是由 'node_modules/NG2的自舉/模態/ modal.module.js' 導出。見
這裏是我的代碼: -
main.ts
import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory';
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
的index.html
<html>
<head>
<title>Jobkeeper</title>
<!-- <base href="/"> -->
<meta charset="UTF-8">
<link rel="stylesheet" href="app/style.css" />
<link rel="stylesheet" href="app/forms.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="app/assets/frontend/custom/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="app/assets/frontend/custom/css/bootstrap.min.css">
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script data-turbolinks-track="true" src="app/assets/frontend/custom/js/bootstrap.min.js"></script>
<!-- 1. Load libraries -->
<!-- Polyfill for older browsers -->
<!-- 2. Configure SystemJS -->
<script>window.module = 'aot';</script>
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app></my-app>
</body>
<!--<script src="dist/build.js"></script>-->
</html>
systemjs.config.js
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
'ng2-bootstrap': 'npm:ng2-bootstrap/bundles/ng2-bootstrap.umd.js'
},
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
'angular2-datatable': {
main: 'index.js',
defaultExtension: 'js'
}
}
});
})(this);
但是,當我使用此代碼沒有AOT,它工作正常。請讓我知道這個問題。
你的或別人的模塊執行從'進口{ModalModule}」 .../modal.module.js'',但'node_modules/NG2的自舉/模式/模式。 module.js'不會導出它。你可以檢查來源。你的項目中是否有模塊版本,應該一起工作? –
我是唯一一個在此工作的人。 –