mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 10:11:50 +08:00
fix(@angular/build): handle undefined less
stylesheet sourcemap values
There can be cases where the `less` stylesheet preprocessor will return an undefined value for a sourcemap even though sourcemaps have been enabled. A check is now performed to handle these cases to prevent potential crashes when processing `less` styles.
This commit is contained in:
parent
44b06f4486
commit
25ea0986b1
@ -130,7 +130,9 @@ async function compileString(
|
|||||||
} as Less.Options);
|
} as Less.Options);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
contents: options.sourcemap ? `${css}\n${sourceMapToUrlComment(map)}` : css,
|
// There can be cases where `less` will return an undefined `map` even
|
||||||
|
// though the types do not specify this as a possibility.
|
||||||
|
contents: map ? `${css}\n${sourceMapToUrlComment(map)}` : css,
|
||||||
loader: 'css',
|
loader: 'css',
|
||||||
watchFiles: [filename, ...imports],
|
watchFiles: [filename, ...imports],
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user