Skip to content

Commit 9c50898

Browse files
authored
docs: mention module: "ES2020" compatibility (#376)
- it's already been supported since eb1dd17, but the docs and error message were not updated to mention it - so add both to make sure users aren't confused - also re-order it to be ES2015, ES2020, then ESNext consistently, which is their module order (c.f. microsoft/TypeScript#24082) - modify test to account for the new error message - make it a bit more resilient to change by only testing a substring as well (c.f. https://jestjs.io/docs/expect#tothrowerror)
1 parent d078f3f commit 9c50898

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ This also allows for passing in different `tsconfig` files depending on your bui
5353

5454
### Some compiler options have more than one compatible value
5555

56-
* `module`: defaults to `ES2015`, other valid value is `ESNext` (required for dynamic imports, see [#54](https://github.com/ezolenko/rollup-plugin-typescript2/issues/54)).
56+
* `module`: defaults to `ES2015`. Other valid values are `ES2020` and `ESNext` (required for dynamic imports, see [#54](https://github.com/ezolenko/rollup-plugin-typescript2/issues/54)).
5757

5858
### Some options need additional configuration on plugin side
5959

__tests__/check-tsconfig.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test("checkTsConfig", () => {
1313
...defaultConfig,
1414
options: { module: ts.ModuleKind.None },
1515
})).toThrow(
16-
`Incompatible tsconfig option. Module resolves to 'None'. This is incompatible with rollup, please use 'module: "ES2015"' or 'module: "ESNext"'.`,
16+
"Incompatible tsconfig option. Module resolves to 'None'. This is incompatible with Rollup, please use",
1717
);
1818

1919
expect(checkTsConfig({

src/check-tsconfig.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ export function checkTsConfig(parsedConfig: tsTypes.ParsedCommandLine): void
66
{
77
const module = parsedConfig.options.module!;
88

9-
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ESNext && module !== tsModule.ModuleKind.ES2020)
10-
throw new Error(`Incompatible tsconfig option. Module resolves to '${tsModule.ModuleKind[module]}'. This is incompatible with rollup, please use 'module: "ES2015"' or 'module: "ESNext"'.`);
9+
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ES2020 && module !== tsModule.ModuleKind.ESNext)
10+
throw new Error(`Incompatible tsconfig option. Module resolves to '${tsModule.ModuleKind[module]}'. This is incompatible with Rollup, please use 'module: "ES2015"', 'module: "ES2020"', or 'module: "ESNext"'.`);
1111
}

0 commit comments

Comments
 (0)