Search code examples
javascriptaureliasystemjsjspm

Moved system.js file from jspm_packages to another folder, wont resolve packages in config


I have a weird scenario where I am using JSPM and Aurelia, and I have a custom route setup to redirect calls to a certain module to go to a local folder (within the project)

  paths: {
    "github:*": "jspm_packages/github/*",
    "npm:*": "jspm_packages/npm/*",
    "blah": "../dist/commonjs/"
  },
  packages: {
    "blah": {
      "main": "index.js",
      "map": {
        "*": "**/*"
      }
    }
  },

then in aurelia I do something like aurelia.plugin("blah"); and that gets system.js to resolve an index.js file in dist/commonjs and all works great then we bundle aurelia and some other stuff and that works fine however we have an issue checking in our jspm_packages folder so we need to have access to system.js outside of that folder so if I change:

<script src="jspm_packages/system.js"></script> (which works) to <script src="libs/system.js"></script>

or some other dir it stops working and instead of resolving blah to dist/commonjs/index.js it tries to resolve dist/commonjs/.js, so its like it ignores the packages but I am a bit baffled as to how including the system.js file from a different folder can change behaviour so much...


Solution

  • So odd thing, it appears there is a bug of sorts here, which can be seen in his issue:

    https://github.com/systemjs/systemjs/issues/1160