-
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
Changes from 2 commits
c432dd2
55d42c1
46963fa
e2f4cdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -18,6 +18,18 @@ let isBlocked = false; | |||||
|
||||||
const normalize = (file) => file.replace(/\\/g, '/'); | ||||||
|
||||||
var getOutputPath = (outputPath) => { | ||||||
for (var i = 0; i < outputPath.length; i++) { | ||||||
if ( | ||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
} | ||||||
return null | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semi-colon
Suggested change
|
||||||
} | ||||||
|
||||||
const escapeRegExp = function(str) { | ||||||
// See details here https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex | ||||||
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&'); | ||||||
|
@@ -170,8 +182,11 @@ function Plugin( | |||||
if (this.entries.has(entry)) { | ||||||
const entryPath = this.entries.get(entry); | ||||||
const outputPath = stats.assetsByChunkName[entry]; | ||||||
|
||||||
this.outputs.set(entryPath, outputPath); | ||||||
|
||||||
if (Array.isArray(outputPath)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add braces around these statements please |
||||||
outputPath = getOutputPath(outputPath); | ||||||
if (outputPath !== null) | ||||||
this.outputs.set(entryPath, 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