-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v4.x] fix(karma-webpack): handle multiple outputs correctly #361
[v4.x] fix(karma-webpack): handle multiple outputs correctly #361
Conversation
miniCssExtractPlugin breaks karma-webpack. Since i dont require styles one way or the other for my unit tests I just remove it from the webpack entry of karma.config as a workarround.
|
@bdirito tried it but it didn't work... Karma-webpack is still receiving multiple entry points. What syntax is that code by the way? Besides the mini CSS extract plugin, enabling source maps also results in multiple entry points being passed (.js and .js.map), but maybe I'm doing something wrong here... |
I can't see the need to have such work workarround. if merging this branch will solve the problem. I test it also with MiniCssExtractPlugin and it is working fine. |
@mario-d-s MiniCssExtractPlugin is only one example of a webpack plugin that produces this issue. Various other plugins can and will also trigger this issue so it will not work in cases where you are using those. Depending on what those plugins do it may or may not be possible to remove them in the same manner, I can only do this because css is irrelevant for my unit testing. The syntax is coffeescript. @alabbas-ali I would prefer to have a fix merged in to webpack-karma but in the absence of that happening (why is review taking so long for an 'urgent regression'?) I wanted something that didnt require building before use. Ideally this issue would be fixed and any such workarounds can be removed. |
I'd also like to know. Can this please be merged and released? |
src/karma-webpack.js
Outdated
@@ -18,6 +18,18 @@ let isBlocked = false; | |||
|
|||
const normalize = (file) => file.replace(/\\/g, '/'); | |||
|
|||
var getOutputPath = (outputPath) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this just a function instead? Or use const
var getOutputPath = (outputPath) => { | |
function getOutputPath(outputPath) { |
var getOutputPath = (outputPath) => { | |
const getOutputPath = (outputPath) => { |
src/karma-webpack.js
Outdated
return outputPath[i] | ||
} | ||
} | ||
return null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semi-colon
return null | |
return null; |
src/karma-webpack.js
Outdated
|
||
this.outputs.set(entryPath, outputPath); | ||
|
||
if (Array.isArray(outputPath)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add braces around these statements please
src/karma-webpack.js
Outdated
outputPath[i].indexOf(".js") !== -1 && | ||
outputPath[i].indexOf(".js.map") === -1 | ||
) { | ||
return outputPath[i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return outputPath[i] | |
return outputPath[i]; |
Any updates on this? Would be really great to have this merged so that I can go forward with upgrading to Webpack 4. |
@michael-ciniawsky any updates? |
Why is this not merged... |
I'm seeing a lot of issues in both 3.x and 4.x around sourcemaps and such too. 3.x has a fix in place for multiple outputs but it introduces more issues than it resolves. It means things like sourcemaps are lost/broken as their outputs are thrown away. This may resolve the issue. If it does, it needs to be added to 3.x too if thats still being maintained. |
@rynclark @michael-ciniawsky any updates on this? As many have pointed out, we are blocked from upgrading to Webpack 4 until this is merged/released |
Please can we review/merge this? At this point just switching wholesale to Jest is seeming very appealing. |
We need contributor for this loader, there is no one here right now, so if you can and have time for this ping me in |
I just got collaborator access. Bear with me as I am trying to get this merged. Currently, I cannot do that as the TravisCI build is pending (and will stay that way). It seems that this check has been ignored since #344 (at least) and that admin rights have been used to merge PRs. If an admin sees this, can you please disable the required check? |
@matthieu-foucault temporary disable, need fix |
Well, I still can't merge this. Looks like only an admin can merge to |
Yeah, that's why I didn't merge - we need @michael-ciniawsky as far as I'm aware |
@evilebottnawi seems to be able to change these things. Can you add @rynclark (my help isn't needed if Ryan is available) to the list of contributors allowed to push to master? |
Thanks @matthieu-foucault. I'm also not able to publish to npm, though. // @evilebottnawi |
This PR contains a:
Motivation / Use-Case
uplift fix multiple output files to 4.x branch
21 09 2018 23:54:23.585:ERROR [karma]: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object