【发布时间】:2015-05-08 19:51:20
【问题描述】:
在 Angular 应用程序中,我使用 grunt build 或 grunt serve:dist 来构建我的生产文件并将它们部署在远程服务器上。一切看起来都很好,我在 yeoman 日志中看不到任何警告消息。 yo doctor 也很高兴(“一切看起来都很好!”)。
问题是,每当我访问我的dist/index.html 时,我都会从控制台收到以下消息:
加载资源失败:服务器响应状态为 404 (未找到)。 http://localhost:9000/components/portal/portal.html
错误:[$compile:tpload] 加载模板失败: 组件/门户/portal.html
portal.html 是应用中未缩小时显示的第一个模板。我很惊讶该应用程序正试图在 components/ 中获取资源,因为所有 html 现在都应该在 dist/index.html 中,对吧?
我正在使用 Yeoman 1.4.6 版和来自 angular 生成器的默认 GruntFile.js。更具体地说,build 任务定义如下:
grunt.registerTask('build', [
'clean:dist',
'wiredep',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
'usemin',
'htmlmin'
]);
什么可能是我的问题的原因?随时索取更多信息。
【问题讨论】: