Skip to content

Commit

Permalink
fix ~ avoid spread operator b/c of Rollup+TS code generation bug
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
rivy committed Jan 11, 2021
1 parent f811b61 commit c6e5443
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/OSPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ export function OSPathsAdaption_(adapter_: Platform.Adapter): OSPaths {
return normalizePath(priorityList.find((v) => !isEmpty(v)));
};

function joinPathToBase(base: string | undefined, segments: readonly string[]) {
return base ? path.join(base, ...segments) : void 0;
function joinPathToBase(base: string | undefined, segments: ReadonlyArray<string>) {
// return base ? path.join(base, ...segments) : void 0;
// 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)
return base ? segments.reduce((acc, val) => path.join(acc, val), base) : void 0;
}

const temp = () => {
Expand Down

0 comments on commit c6e5443

Please sign in to comment.