我在VS 2017 (ASP5WebApi) +systemjs中使用了角4。我试图为生产构建角度应用程序,我在package.json中添加了两个依赖项
"devDependencies": {
.....
"gulp": "3.9.1",
"systemjs-builder": "0.16.11"
}我在asp项目根文件夹中创建了gulpfile.js
var gulp = require('gulp'),
Builder = require('systemjs-builder');
gulp.task('bundle-angular-dependencies', function() {
// optional constructor options
// sets the baseURL and loads the configuration file
var builder = new Builder('', 'systemjs.config.js');
return builder
.bundle('app/boot.js - [app/**/*.js]', 'path/to/put/angular.bundle.js', { minify: true})
.then(function() {
console.log('Build complete');
})
.catch(function(err) {
console.log('Build error');
console.log(err);
});
});然后在项目的根文件夹中运行:
gulp bundle-angular-dependencies并得到了
Build error
Error: Unable to calculate canonical name to bundle file:///app/boot.js. Ensure that this module sits within the baseURL or a wildcard path config.
at getCanonicalNamePlain (D:\myapp\node_modules\systemjs-builder\lib\utils.js:227:13)
at getCanonicalName (D:\myapp\node_modules\systemjs-builder\lib\utils.js:150:19)
at D:\myapp\node_modules\systemjs-builder\lib\arithmetic.js:171:38
at <anonymous>
[18:50:43] Finished 'bundle-angular-dependencies' after 604 ms谢谢你的帮助
发布于 2017-10-16 16:28:52
为什么不为Visual 2017使用新的内置角度模板呢?
File _ New _ Project项目
选择ASP.NET核心Web应用程序模板
然后在“新建ASP.NET核心网络应用程序”对话框中,选择角。

https://stackoverflow.com/questions/46774353
复制相似问题