Skip to content

Commit

Permalink
fix: config.transformPath function + force *.js by default
Browse files Browse the repository at this point in the history
  • Loading branch information
daKmoR committed Dec 11, 2018
1 parent bf966f0 commit 5a05452
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/karma-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,19 @@ function preprocessorFactory(config, emitter) {
controller.karmaEmitter = emitter;
}

const transformPath =
config.webpack.transformPath ||
((filepath) => {
// for *.js files by default
const info = path.parse(filepath);
return `${path.join(info.dir, info.name)}.js`;
});

return async function processFile(content, file, done) {
await controller.bundle();

file.path = transformPath(file.path); // eslint-disable-line no-param-reassign

const bundleContent = controller.bundlesContent[path.parse(file.path).base];
done(null, bundleContent);
};
Expand Down

0 comments on commit 5a05452

Please sign in to comment.