Can't specify transformPath
- webpack Version: 5
- karma-webpack Version: 5
Expected Behavior
providing transformPath per the README works
Actual Behavior
The option is also passed to webpack which throws because it validates the config and transformPath is not a valid webpack option
How Do We Reproduce?
provide transformPath in config.webpack and try and do a test run
Can you post your webpack + karma configurations?
any config with the option set would have this issue, here's a minimal one!
module.exports = (config) => {
config.set({
frameworks: ['webpack'],
files: ['test/entry.ts'],
preprocessors: {
'test/entry.ts': ['webpack'],
},
webpack: {
transformPath: (filepath) => {
// force *.js files by default
const info = path.parse(filepath);
return `${path.join(info.dir, info.name)}.js`;
},
},
});
};
Thanks for creating an issue,
I can confirm that transformPath does not work as expected. This was a feature that existed prior to me working on this project and interestingly I just created an integration test mimicking your setup but without the transformPath option and everything works as expected. Could you give this a shot without the transformPath option?
It seems that in any case this is not a valid configuration field for webpack and that it will always cause failures. If simply removing that option fixes your setup, I will remove the transformPath docs entirely.
Yeah it works fine without it, since the default works find for TS. I'm not sure if anyone would need to specify it
Just made a PR to update the docs, thanks for pointing this out