karma-runner / karma-commonjs

A Karma plugin. Test CommonJS modules.
MIT License
73 stars 30 forks source link

Unable to load external module that has been transpiled from Typescript and that is required from my app #52

Open lucaoliano opened 8 years ago

lucaoliano commented 8 years ago

I have an external npm common module, shared from all my apps, that is wirtten in Typescript. Supposing that this module is called common_module, when I build it, the transpiler for each typescript import generates a require('file_name'). When karma-commonjs tries to resolve these require, it searches for something like .../node_modules/file_name, but the module is located at .../node_modules/common_module.

dignifiedquire commented 8 years ago

This sounds like an issue with Typescript. How should the resolver for require know that 'filename' is not what it ahould load

lucaoliano commented 8 years ago

In the pull request https://github.com/karma-runner/karma-commonjs/pull/53, I've proposed a solution to solve it.

My proposal is configure into Karma configuration, which module resolves the file required.