gulp-jspm-build icon indicating copy to clipboard operation
gulp-jspm-build copied to clipboard

Error on fetch for @angular/core

Open impworks opened this issue 7 years ago • 1 comments

Angular2 used to provide SystemJS bundles in their older package (angular2), but they stopped doing so after RC. I tried to use gulp-jspm-build to create such a package myself, but a nasty error keeps popping up.

Ideally, I would like to have just one angular.js file with all core modules concatenated. It will be included onto the page in a script tag, so that no modules will have to be dynamically loaded at runtime.

I started small, with just one module. Here is the gulpfile.js:

var gulp = require('gulp'),
    jspm = require('gulp-jspm-build');

gulp.task('libs:angular', function() {
    jspm({
        config: './system.config.js',
        bundleOptions: {
            minify: false,
            mangle: false
        },
        bundles: [
            { src: '@angular/core', dst: 'angular.js' }
        ]
    })
    .pipe(gulp.dest(paths.assets.js));
});

And here is system.config.js:

System.config({
    defaultJSExtensions: true,
    paths: {
        "*": "node_modules/*"
    },
    packages: {
        '@angular/core': { main: 'index.js', defaultExtension: 'js' }
    }
});

The following error shows up:

Error on fetch for @angular/core at file:///C:/tests/WebTest/@angular/core
    Error: ENOENT: no such file or directory, open 'C:\tests\WebTest\@angular\core'
    at Error (native)

The root folder (where gulpfile.js and system.config.js are stored) is C:\tests\WebTest. The correct folder for @angular/core would be C:\tests\WebTests\node_modules\@angular\core.

My config file does not seem to be loaded at all. Even when I mess it up, add syntax errors or even specify an invalid path to it, the error does not change. Copying the entire config into configOverride section does not change anything either.

What am I doing wrong?

impworks avatar Jul 15 '16 13:07 impworks