mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
- it's already been supported since eb1dd17babde0b22e9540b12e671eb56d9d6bce0, 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. https://github.com/microsoft/TypeScript/issues/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)
12 lines
546 B
TypeScript
12 lines
546 B
TypeScript
import * as tsTypes from "typescript";
|
|
|
|
import { tsModule } from "./tsproxy";
|
|
|
|
export function checkTsConfig(parsedConfig: tsTypes.ParsedCommandLine): void
|
|
{
|
|
const module = parsedConfig.options.module!;
|
|
|
|
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ES2020 && module !== tsModule.ModuleKind.ESNext)
|
|
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"'.`);
|
|
}
|