Search code examples
javascriptsystemjsjspmbuildingsystemjs-builder

JSPM Bundle with missing json files


I'm getting a wrong bundle file when I execute the command:

jspm bundle src/main.js main-bundle.js

Files like npm:@angular/[email protected] are not include, no .json files are included, only .js files, however, if I launch the same command from OSX those fields are included

From OSX (valid bundle file content):

   npm:@angular/[email protected]
   npm:@angular/[email protected]/bundles/animations-browser.umd.min.js
   npm:@angular/[email protected]/bundles/animations.umd.js
   npm:@angular/[email protected]
   npm:@angular/[email protected]/bundles/common.umd.js
   npm:@angular/[email protected]
   npm:@angular/[email protected]/bundles/compiler.umd.js
   npm:@angular/[email protected]
   npm:@angular/[email protected]/bundles/core.umd.js
   npm:@angular/[email protected]
   npm:@angular/[email protected]/bundles/forms.umd.js
   npm:@angular/[email protected]
   npm:@angular/[email protected]/bundles/http.umd.js
   npm:@angular/[email protected]
   npm:@angular/[email protected]/bundles/material.umd.js
   npm:@angular/[email protected]
   npm:@angular/[email protected]/bundles/platform-browser-dynamic.umd.js
   npm:@angular/[email protected]
   npm:@angular/[email protected]/bundles/platform-browser-animations.umd.min.js
   npm:@angular/[email protected]/bundles/platform-browser.umd.js
   npm:@angular/[email protected]
   npm:@angular/[email protected]/bundles/router.umd.js
   npm:[email protected]
   npm:[email protected]/client/shim.js
   npm:[email protected]/es6/reflect.js
   npm:[email protected]/es7/reflect.js

From Linux (wrong bundle file, missing json package definitions):

   npm:@angular/[email protected]/bundles/animations-browser.umd.min.js
   npm:@angular/[email protected]/bundles/animations.umd.js
   npm:@angular/[email protected]/bundles/common.umd.js
   npm:@angular/[email protected]/bundles/compiler.umd.js
   npm:@angular/[email protected]/bundles/core.umd.js
   npm:@angular/[email protected]/bundles/forms.umd.js
   npm:@angular/[email protected]/bundles/http.umd.js
   npm:@angular/[email protected]/bundles/material.umd.js
   npm:@angular/[email protected]/bundles/platform-browser-dynamic.umd.js
   npm:@angular/[email protected]/bundles/platform-browser-animations.umd.min.js
   npm:@angular/[email protected]/bundles/platform-browser.umd.js
   npm:@angular/[email protected]/bundles/router.umd.js
   npm:[email protected]/client/shim.js
   npm:[email protected]/es6/reflect.js
   npm:[email protected]/es7/reflect.js
   npm:[email protected]/modules/_a-function.js

Both are using the same version of jspm (0.17.0-beta.41), systemjs (0.20.10) and systemjs-builder (0.16.4), I suppose that there is something different in both environments that is affecting, but I've removed the ~/.jspm directory for a clean env with the same results, and I'm not sure what else could be affecting.

The jspm.config.js file is the same in both cases:

SystemJS.config({
  nodeConfig: {
    "paths": {
      "github:": "jspm_packages/github/",
      "npm:": "jspm_packages/npm/"
    }
  },
  devConfig: {
    "map": {
      "plugin-typescript": "github:frankwallis/[email protected]",
      "typescript": "npm:[email protected]",
      "child_process": "npm:[email protected]",
      "module": "npm:[email protected]",
      "net": "npm:[email protected]"
    },
    "packages": {
      "npm:[email protected]": {
        "map": {
          "source-map": "npm:[email protected]"
        }
      },
      "npm:[email protected]": {
        "map": {
          "source-map-support": "npm:[email protected]"
        }
      }
    }
  },
  transpiler: false,
  packages: {
    "environments": {
      "defaultExtension": "js"
    },
    "src": {
      "defaultExtension": "js"
    }
  },
  map: {
    "@angular/animations/browser": "npm:@angular/[email protected]/bundles/animations-browser.umd.min.js",
    "@angular/platform-browser/animations": "npm:@angular/[email protected]/bundles/platform-browser-animations.umd.min.js",
    "app": "src/app"
  }
});

SystemJS.config({
  packageConfigPaths: [
    "github:*/*.json",
    "npm:@angular/*.json",
    "npm:@covalent/*.json",
    "npm:*.json"
  ],
  map: {
    "@angular/animations": "npm:@angular/[email protected]",
    "@angular/common": "npm:@angular/[email protected]",
    "@angular/compiler": "npm:@angular/[email protected]",
    "@angular/core": "npm:@angular/[email protected]",
    "@angular/forms": "npm:@angular/[email protected]",
    "@angular/http": "npm:@angular/[email protected]",
    "@angular/material": "npm:@angular/[email protected]",
    "@angular/platform-browser": "npm:@angular/[email protected]",
    "@angular/platform-browser-dynamic": "npm:@angular/[email protected]",
    "@angular/router": "npm:@angular/[email protected]",
    "@covalent/core": "npm:@covalent/[email protected]",
    "@covalent/dynamic-forms": "npm:@covalent/[email protected]",
    "@covalent/http": "npm:@covalent/[email protected]",
    "angular-in-memory-web-api": "npm:[email protected]",
    "angular-safeguard": "npm:[email protected]",
    "assert": "npm:[email protected]",
    "buffer": "npm:[email protected]",
    "constants": "npm:[email protected]",
    "core-js": "npm:[email protected]",
    "crypto": "npm:[email protected]",
    "events": "npm:[email protected]",
    "file-saver": "npm:[email protected]",
    "fs": "npm:[email protected]",
    "hammerjs": "npm:[email protected]",
    "ng2-toastr": "npm:[email protected]",
    "os": "npm:[email protected]",
    "path": "npm:[email protected]",
    "process": "npm:[email protected]",
    "rxjs": "npm:[email protected]",
    "stream": "npm:[email protected]",
    "string_decoder": "npm:[email protected]",
    "timers": "npm:[email protected]",
    "util": "npm:[email protected]",
    "vm": "npm:[email protected]",
    "web-animations-js": "npm:[email protected]",
    "zone.js": "npm:[email protected]"
  },
  packages: {
      // SKIPPED //
  }
});

If I understand correctly, the missing json files are processed but not included, the file "npm:@angular/[email protected]/bundles/http.umd.js" is included because is defined in "npm:@angular/[email protected]", however, for some reason the package definition file is skipped in the bundle.

¿ Is there any other file that I should check in both environments ? Any idea is welcome.

UPDATE: After some tests, I suspect that the problem is related with systemjs-builder lib, not jspm


Solution

  • Finally, I found the problem, the method getPackageConfigPath(...) in utils.js in the lib systemjs-builder fails (returns nothing) if the directory absolute path with the packageConfigPaths contains a "(".

    In linux, the jenkins job had a name like "MyProject (angular2)", and this was causing that the building process couldn't find the packageConfigPath for none of the libs in the bundle.

    I've opened an issue on the github project: https://github.com/systemjs/builder/issues/811