【发布时间】:2023-04-05 16:32:02
【问题描述】:
对 System.js 和 Angular 2 有一个有趣的问题。
在默认的快速入门中,我们有这个系统配置:
System.config({
packages: {
built: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('built/main')
.then(null, console.error.bind(console));
它对我有用。 但现在我尝试从构建的 upp 中移动所有文件。所以 main.js 文件与 index.html 位于一层。所以目前无法部署系统包。因为你需要一些文件夹名称(所有 node_modules 都正确安装在根文件夹中,所有 angular2 东西)。
我尝试使用一些简单的配置:
System.config({
defaultJSExtensions: true
});
System.import('main')
.then(null, console.error.bind(console));
但有很多这样的错误:
system.src.js:1061 获取 http://localhost:3000/angular2/platform/browser.js404 system.src.js:1061 获取http://localhost:3000/angular2/router.js 404 (未找到)
感谢您的帮助!
【问题讨论】:
-
我认为这是因为系统不知道她必须在哪里寻找(node_module)。但这只是想法..