rollup-plugin-ts
rollup-plugin-ts copied to clipboard
Plugin crashes with Error: Debug Failure. False expression: Lexical environment is suspended.
- Version: 1.3.6
- Rollup Version: 2.32.1
- Operating System and version (if applicable): Windows 10 2004
- Node Version (if applicable): 12.18.3
- Does it work with
tsc
(if applicable): yes
Reproduction
Clone the following repo, run yarn
or npm install
, and run yarn start
or npm start
:
https://github.com/arseneyr/rollup-ts-broken
Expected Behavior
Rollup compiles successfully.
Actual Behavior
Fails with:
C:\Users\a\Repos\rollup-ts-broken>yarn start
yarn run v1.22.5
$ rollup -c
index.ts → stdout...
[!] (plugin Typescript) Error: Debug Failure. False expression: Lexical environment is suspended.Error: Debug Failure. False expression: Lexical environment is suspended.
at Object.startLexicalEnvironment (C:\Users\a\Repos\rollup-ts-broken\node_modules\typescript\lib\typescript.js:96916:22)
at visitLexicalEnvironment (C:\Users\a\Repos\rollup-ts-broken\node_modules\typescript\lib\typescript.js:78414:17)
at Object.visitEachChild (C:\Users\a\Repos\rollup-ts-broken\node_modules\typescript\lib\typescript.js:78798:55)
at Object.childContinuation (C:\Users\a\Repos\rollup-ts-broken\node_modules\@wessberg\rollup-plugin-ts\dist\cjs\index.js:4306:194)
at visitSourceFile (C:\Users\a\Repos\rollup-ts-broken\node_modules\@wessberg\rollup-plugin-ts\dist\cjs\index.js:4028:20)
at visitNode$4 (C:\Users\a\Repos\rollup-ts-broken\node_modules\@wessberg\rollup-plugin-ts\dist\cjs\index.js:4034:16)
at Object.continuation (C:\Users\a\Repos\rollup-ts-broken\node_modules\@wessberg\rollup-plugin-ts\dist\cjs\index.js:4306:433)
at C:\Users\a\Repos\rollup-ts-broken\node_modules\@wessberg\rollup-plugin-ts\dist\cjs\index.js:4352:37
at applyTransformers (C:\Users\a\Repos\rollup-ts-broken\node_modules\@wessberg\rollup-plugin-ts\dist\cjs\index.js:2017:37)
at Object.includeSourceFile (C:\Users\a\Repos\rollup-ts-broken\node_modules\@wessberg\rollup-plugin-ts\dist\cjs\index.js:4343:47)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I'm not entirely sure what's causing this, but I've tried to create as minimal a repro as possible. Looks like some sort of interaction between templated static methods and imported mapped types? It seems to be a result of generating definition files, as it compiles successfully if "declaration": false
is set in tsconfig.json
.
Otherwise great plugin, thanks for your work!
Getting the same issue 🙁
Version: 1.3.8 Rollup Version: 2.33.3 Operating System and version (if applicable): Mac OS Node Version (if applicable): 12.16.2 Does it work with tsc (if applicable): yes
Got the same issue and think I made some progress. It seems to stem from (A) defining a function that (B) infers it's return type which (C) includes a generic. By either changing the function declaration into a function expression or explicitly adding a return type, I am able to get around the failure in your example repo.
The change is in index.ts:3 from export function f(arg: "a" | "b") {
to export const f = function (arg: "a" | "b") {
I just encountered this issue.
Got the same issue.
I removed the problematic assertion statements in TypeScript’s typescript.js
directly and it builds fine now. It’s a silly hack but it works.