Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/helpers/getCssExports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const getCssExports = ({
syncImport: true,
filename: fileName,
paths: [directory],
sourceMap: true,
...(rendererOptions.less ?? {}),
} as Less.Options,
(error?: Less.RenderError, output?: Less.RenderOutput) => {
Expand All @@ -85,6 +86,11 @@ export const getCssExports = ({
if (output === undefined) {
throw new Error('No Less output.');
}

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the types wrong here? Did you encounter a situation where this could be falsey?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less.RenderOutput.map is typed as string, but it can output undefined, so yes, the types are wrong.

sourceMap = JSON.parse(output.map ?? 'undefined') as
| RawSourceMap
| undefined;
transformedCss = output.css.toString();
},
);
Expand Down