mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-16 15:56:33 +00:00
Fix flash from url on windows
Changelog-entry: Fix flash from url on windows Change-type: patch
This commit is contained in:
parent
29e2e9c657
commit
b749c2d45a
@ -96,11 +96,15 @@ interface ReplacementRule {
|
|||||||
replace: string | (() => string);
|
replace: string | (() => string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function slashOrAntislash(pattern: RegExp): RegExp {
|
||||||
|
return new RegExp(pattern.source.replace(/\\\//g, '(\\/|\\\\)'));
|
||||||
|
}
|
||||||
|
|
||||||
function replace(test: RegExp, ...replacements: ReplacementRule[]) {
|
function replace(test: RegExp, ...replacements: ReplacementRule[]) {
|
||||||
return {
|
return {
|
||||||
loader: 'string-replace-loader',
|
loader: 'string-replace-loader',
|
||||||
// Handle windows path separators
|
// Handle windows path separators
|
||||||
test: new RegExp(test.source.replace(/\\\//g, '(\\/|\\\\)')),
|
test: slashOrAntislash(test),
|
||||||
options: { multiple: replacements.map((r) => ({ ...r, strict: true })) },
|
options: { multiple: replacements.map((r) => ({ ...r, strict: true })) },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -223,7 +227,7 @@ const commonConfig = {
|
|||||||
// Force axios to use http.js, not xhr.js as we need stream support
|
// Force axios to use http.js, not xhr.js as we need stream support
|
||||||
// (it's package.json file replaces http with xhr for browser targets).
|
// (it's package.json file replaces http with xhr for browser targets).
|
||||||
new NormalModuleReplacementPlugin(
|
new NormalModuleReplacementPlugin(
|
||||||
/node_modules\/axios\/lib\/adapters\/xhr\.js/,
|
slashOrAntislash(/node_modules\/axios\/lib\/adapters\/xhr\.js/),
|
||||||
'./http.js',
|
'./http.js',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user