make buildhelper compatible with previous tsconfig #1

Closed
BrianHung wants to merge 1 commit from patch-1 into main
BrianHung commented 2021-03-14 05:50:30 +01:00 (Migrated from github.com)

The move from each codemirror 6 repo having its own separate rollup and tsconfig to a single buildhelper (e.g. with @codemirror/autocomplete) broke dist compatibility due to changes in target, module, etc.

One example is the nullish coalescing operator found in the dist of @codemirror/autocomplete, resulting in the following error:

./node_modules/@codemirror/autocomplete/dist/index.js 134:93
Module parse failed: Unexpected token (134:93)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     if (!addStart && !addEnd)
|         return expr;
>     return new RegExp(`${addStart ? "^" : ""}(?:${source})${addEnd ? "$" : ""}`, expr.flags ?? (expr.ignoreCase ? "i" : ""));
| }

Edit: Oops. On further reading of buildhelper, I realized the tsconfig used in the build step was contained inside of src/build.ts and was not /tsconfig.json. Last commit fixes that.

The move from each codemirror 6 repo having its own separate rollup and tsconfig to a single buildhelper (e.g. with [`@codemirror/autocomplete`](https://github.com/codemirror/autocomplete/blob/45b277af094d22235abc3510c22f3d18f0f782d7/tsconfig.local.json)) broke `dist` compatibility due to changes in `target`, `module`, etc. One example is the nullish coalescing operator found in the `dist` of `@codemirror/autocomplete`, resulting in the following error: ```js ./node_modules/@codemirror/autocomplete/dist/index.js 134:93 Module parse failed: Unexpected token (134:93) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | if (!addStart && !addEnd) | return expr; > return new RegExp(`${addStart ? "^" : ""}(?:${source})${addEnd ? "$" : ""}`, expr.flags ?? (expr.ignoreCase ? "i" : "")); | } ``` Edit: Oops. On further reading of buildhelper, I realized the tsconfig used in the build step was contained inside of `src/build.ts` and was not `/tsconfig.json`. Last commit fixes that.
marijnh commented 2021-03-14 08:28:51 +01:00 (Migrated from github.com)

Looks like the es2020 target was indeed an accident. Is the removal of the declarationMap setting causing any problems for you? The rolled-up declaration doesn't use those anyway, so I believe that just causes the TypeScript compiler to waste time creating maps that are never read.

Looks like the es2020 target was indeed an accident. Is the removal of the declarationMap setting causing any problems for you? The rolled-up declaration doesn't use those anyway, so I believe that just causes the TypeScript compiler to waste time creating maps that are never read.
BrianHung commented 2021-03-14 11:41:13 +01:00 (Migrated from github.com)

Is the removal of the declarationMap setting causing any problems for you?

It seemed useful when reading its functionality in tsconfig, but if src files aren't shipped with the dist as with npm, then yeah it'd be to fine to remove declarationMap and save compiler time.

> Is the removal of the declarationMap setting causing any problems for you? It seemed useful when reading its [functionality in tsconfig](https://www.typescriptlang.org/tsconfig#declarationMap), but if `src` files aren't shipped with the `dist` as with npm, then yeah it'd be to fine to remove `declarationMap` and save compiler time.
marijnh commented 2021-03-14 11:56:07 +01:00 (Migrated from github.com)

Thanks. I've merged this without the declaration map change and released fixed version of @codemirror/state and @codemirror/autocomplete.

Thanks. I've merged this without the declaration map change and released fixed version of \@codemirror/state and \@codemirror/autocomplete.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/buildhelper!1
No description provided.