-
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
fix(karma-webpack): handle outputPath
correctly
#360
fix(karma-webpack): handle outputPath
correctly
#360
Conversation
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.
@alabbas-ali Thx for taking a stab at this again :)
src/karma-webpack.js
Outdated
@@ -17,6 +17,15 @@ var isBlocked = false | |||
|
|||
const normalize = (file) => file.replace(/\\/g, '/') | |||
|
|||
var getJsOutput = (outputPathArray) => { |
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.
- var getJsOutput
+ var getOutputPath
- ... = (outputPathArray) =>
+ ... = (outputPath) =>
src/karma-webpack.js
Outdated
@@ -17,6 +17,15 @@ var isBlocked = false | |||
|
|||
const normalize = (file) => file.replace(/\\/g, '/') | |||
|
|||
var getJsOutput = (outputPathArray) => { | |||
for (var _i = 0; _i < outputPathArray.length; _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.
- var _i
+ var i
src/karma-webpack.js
Outdated
@@ -17,6 +17,15 @@ var isBlocked = false | |||
|
|||
const normalize = (file) => file.replace(/\\/g, '/') | |||
|
|||
var getJsOutput = (outputPathArray) => { | |||
for (var _i = 0; _i < outputPathArray.length; _i++) { | |||
if (outputPathArray[_i].indexOf(".js") != -1) { |
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.
How des this work? Could you give a five examples please? What happens if e.g file.js.map
takes precedence?
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.
- !=
+ !==
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.
How des this work? Could you give a five examples please? What happens if e.g file.js.map
takes precedence?
You are right. I did not consider this case actually? I have in my webpack config 3 entries. like
entry: {
app: ${scriptsPath}/ibe/${IBEClient}/app.ts
,
vendor: ${scriptsPath}/vendor.browser.ts
,
polyfills: ${scriptsPath}/polyfills.browser.ts
,
}
So, I move the entries to Karma config to get the same output form webpack. and remove it form webpack config. mostly I didn't see this case because is the .js output is always before file.js.map output in all my cases. The problem I faced is if the webpack shanks has .css.map as first output.
In any case i will add .js.map to if condition which should solve this case also :)
src/karma-webpack.js
Outdated
this.outputs[entryPath] = outputPath | ||
if (Array.isArray(outputPath)) | ||
outputPath = getJsOutput(outputPath) | ||
if (outputPath != 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.
- !=
+ !==
outputPath
correctly
@alabbas-ali In which case(s) is the |
As I said in the comment up. I have 3 entries: entry: { I move them to karma config, with devtool: 'inline-source-map' the output was the .js files as first output. |
Using https://github.com/webpack-contrib/mini-css-extract-plugin also moves the CSS to be the first entry in the list. |
Are you going to merge this in the near future ?? |
This comment has been minimized.
This comment has been minimized.
Could You merge this also ??? |
Thanks for the merge! Anything left to do before this can be published on npm? |
It seems that the fix that we published in |
We recently noticed this issue in Webpack Encore (see symfony/webpack-encore#256 (comment)) since we always use the Is there any plan about releasing a new |
This PR contains a:
Motivation / Use-Case
Refer to #357
The webpack output is not always the JS as first URL output