Skip to content

Commit 26b9fee

Browse files
committed
fix ~ avoid spread operator b/c of Rollup+TS code generation bug
- associated FixME also added ## [why] For ESM builds, when using the array spread operator, Rollup (using TypeScript) generates a helper file containing the `__spreadArrays()` function. Unfortunately, when using LF line endings (eg, tsconfig contains `"newLine": "lf"`) the file is generated with mixed line endings (both CRLF and LF). This causes `git` to throw errors when trying to commit the generated file. Cosmetically, the file is also generated with a '.js' suffix even when forcing '.mjs'. FixME added
1 parent 9e692e9 commit 26b9fee

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib/OSPaths.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ export function OSPathsAdaption_(adapter_: Platform.Adapter): OSPaths {
5454
return normalizePath(priorityList.find((v) => !isEmpty(v)));
5555
};
5656

57-
function joinPathToBase(base: string | undefined, segments: readonly string[]) {
58-
return base ? path.join(base, ...segments) : void 0;
57+
function joinPathToBase(base: string | undefined, segments: ReadonlyArray<string>) {
58+
// return base ? path.join(base, ...segments) : void 0;
59+
// fixme: [2021-01-08; rivy] ~ avoiding the spread operator to avoid TS+rollup production of mixed-EOL-type module file (which causes other build problems)
60+
return base ? segments.reduce((acc, val) => path.join(acc, val), base) : void 0;
5961
}
6062

6163
const temp = () => {

0 commit comments

Comments
 (0)