0

I'm using Angular 4 with VS 2017 (ASP 5 Web Api) +systemjs. I'm trying to build Angular application for production,I've added 2 dependencies in package.json

"devDependencies": {
    .....
    "gulp": "3.9.1",
    "systemjs-builder": "0.16.11"
  }

I've created create gulpfile.js in asp project root folder

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);
    });
});

then in root folder of project I've run :

gulp bundle-angular-dependencies

and got

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

thanks for any help

1 Answer 1

1

Why not use the new built-in Angular templates for Visual Studio 2017?

File | New | Project

Select the ASP.NET Core Web Application template

Then in the "New ASP.NET Core Web Application" dialog, select Angular.

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

Hi Deborah,I'm not using ASP Core,I'm using ASP 5.I think that will not work.thanks
Have you seen this: hanselman.com/blog/… ASP.NET 5 is Asp.NET Core.
I know.but my db provider not fully support Core now.thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.