karma-jspm icon indicating copy to clipboard operation
karma-jspm copied to clipboard

Custom alias in map returning a 404

Open linnett opened this issue 9 years ago • 1 comments

I've got an issue where one of my custom aliases in my config.js file is returning 404 when running tests. In my config.js file, I reference a config file as so:

System.config({
  "map": {
    "main.config": "./modules/main.config"
  }
});

This allows me to add the following to files like this: import mainConfig from 'main.config', rather than referencing the whole path. The test returns: WARN [web-server]: 404: /base/modules/main.config.js. When it errored, I assumed I would need to add it as a path to the karma config file:

paths: {
  'main.config': 'modules/main.config.js'
}

Unfortunately, this does not work either. Is there something I am doing wrong? Help is really appreciated. Thanks

linnett avatar Jun 18 '15 15:06 linnett

Got it to work!! By changing the proxy, it seemed to fix it:

proxies: {
      '/base/modules/': '/base/app/src/modules/'
}

Is there a reason I need to proxy it to make it work? Is there a way to correctly set the base path without having to do this?

linnett avatar Jun 18 '15 15:06 linnett