Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(upstream TypeScript bug) Builds hang with typescript 4.4.2 #983

Open
RebeccaStevens opened this issue Aug 25, 2021 · 16 comments
Open

(upstream TypeScript bug) Builds hang with typescript 4.4.2 #983

RebeccaStevens opened this issue Aug 25, 2021 · 16 comments

Comments

@RebeccaStevens
Copy link

RebeccaStevens commented Aug 25, 2021

  • Rollup Plugin Name: @rollup/plugin-typescript
  • Rollup Plugin Version: 8.2.5
  • Rollup Version: 2.56.3
  • Operating System (or Browser): Ubuntu 20.04.2 LTS (via WSL on Windows 10)
  • Node Version: 16.4.0
  • Link to reproduction:

Expected Behavior

The build should complete.

Actual Behavior

The build hangs. (The cli command never completes.)

@shellscape
Copy link
Collaborator

I'd recommend using a stable version of TS. We won't test the plugin against it until they release a stable. You might also want to try that locally to see if it's reproducible.

@RebeccaStevens
Copy link
Author

Yes, it reproducible locally.

@johndiiorio
Copy link

I am also able to reproduce this issue. 4.4-beta works but 4.4-rc (and the nightly 4.5.0-dev.20210824) hangs indefinitely.

@shellscape
Copy link
Collaborator

Good info. We'll welcome triage on this, but until a stable release is cut from the TypeScript folks, the core team here likely won't troubleshoot this. We'll have to wait for a stable release to merge any fixes as well.

@johndiiorio
Copy link

Thanks, I understand.
Just wanted to give a heads up that this issue is reproducible on the stable TypeScript 4.4.2 that was just released.

@RebeccaStevens RebeccaStevens changed the title Rollup builds hang with typescript 4.4.1-rc Rollup builds hang with typescript 4.4.2 Aug 27, 2021
@alshdavid
Copy link

Can confirm this is an issue with stable TypeScript 4.4.2.
If a developer was to create a new rollup + typescript project today it would hang on compilation.

birtles added a commit to birchill/bugsnag-zero that referenced this issue Aug 27, 2021
Rollup is broken with TypeScript 4.4 due to

rollup/plugins#983
eemeli added a commit to eemeli/yaml that referenced this issue Aug 27, 2021
@michael42
Copy link

Running my (hanging) build (with an empty file to bundle) using why-is-node-running produces this output:

There are 13 handle(s) keeping the process running

# Timeout
node:internal/async_hooks:205                                                                    
node:internal/async_hooks:495                                                                    
node:internal/timers:162                                                                         
node:internal/timers:196                                                                         
/project/rollup.config.js:16                                   - dir: "build",
node:internal/modules/cjs/loader:1101                                                            
/project/node_modules/rollup/dist/shared/loadConfigFile.js:540 - module._compile(bundledCode, requiredFileName);
node:internal/modules/cjs/loader:981                                                             

# TTYWRAP
node:internal/async_hooks:205                                                       
node:internal/bootstrap/switches/is_main_thread:47                                  
node:internal/bootstrap/switches/is_main_thread:135                                 
node:internal/console/constructor:216                                               
node:internal/console/constructor:333                                               
node:internal/console/constructor:368                                               
/project/node_modules/rollup/dist/bin/rollup:1506 - loadConfigFile_js.stderr(loadConfigFile_js.cyan(`\n${loadConfigFile_js.bold(inputFiles)} → ${loadConfigFile_js.bold(files.join(', '))}...`));
/project/node_modules/rollup/dist/bin/rollup:1692 - await build(inputOptions, warnings, command.silent);

# STATWATCHER
node:internal/async_hooks:205                                                               
node:internal/fs/watchers:105                                                               
/project/node_modules/typescript/lib/typescript.js:7670   - _fs.watchFile(fileName, { persistent: true, interval: pollingInterval }, fileChanged);
/project/node_modules/typescript/lib/typescript.js:6924   - watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
/project/node_modules/typescript/lib/typescript.js:7247   - return pollingWatchFile(fileName, callback, PollingInterval.Low, /*options*/ undefined);
/project/node_modules/typescript/lib/typescript.js:110912 - watchFile: function (file, callback, pollingInterval, options) { return host.watchFile(file, callback, pollingInterval, options); },
/project/node_modules/typescript/lib/typescript.js:110938 - factory[key].call(/*thisArgs*/ undefined, file, cb, flags, options, detailInfo1, detailInfo2) :
/project/node_modules/typescript/lib/typescript.js:118559 - return watchFile(file, function (fileName, eventKind) { return callback(fileName, eventKind, path); }, pollingInterval, options, watchType);

# STATWATCHER
node:internal/async_hooks:205                                                               
node:internal/fs/watchers:105                                                               
/project/node_modules/typescript/lib/typescript.js:7670   - _fs.watchFile(fileName, { persistent: true, interval: pollingInterval }, fileChanged);
/project/node_modules/typescript/lib/typescript.js:6924   - watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
/project/node_modules/typescript/lib/typescript.js:7247   - return pollingWatchFile(fileName, callback, PollingInterval.Low, /*options*/ undefined);
/project/node_modules/typescript/lib/typescript.js:110912 - watchFile: function (file, callback, pollingInterval, options) { return host.watchFile(file, callback, pollingInterval, options); },
/project/node_modules/typescript/lib/typescript.js:110938 - factory[key].call(/*thisArgs*/ undefined, file, cb, flags, options, detailInfo1, detailInfo2) :
/project/node_modules/typescript/lib/typescript.js:118559 - return watchFile(file, function (fileName, eventKind) { return callback(fileName, eventKind, path); }, pollingInterval, options, watchType);

[... 9 more # STATWATCHER] 

It seems to me that TypeScript is keeping open a few watchers... I added a few console.log at typescript.js:7670 and it seems that Typescript creates a lot of watchers and does not unregister all of them (383/394 in my case, which is consistent with the 11 STATWATCHER in the output). Analyzing the output, it seems that the watchers for the package.jsons of the @types packages are not properly closed (package.jsons are only loaded from @types packages in my output and all 11 of them are not closed):

Set(11) {
  '/project/common/node_modules/@types/pouchdb-core/package.json',
  '/project/common/node_modules/@types/pouchdb-find/package.json',
  '/project/node_modules/@types/pouchdb-core/package.json',
  '/project/node_modules/@types/pouchdb-find/package.json',
  '/project/server/node_modules/@types/benchmark/package.json',
  '/project/server/node_modules/@types/debug/package.json',
  '/project/server/node_modules/@types/express-serve-static-core/package.json',
  '/project/server/node_modules/@types/node/package.json',
  '/project/server/node_modules/@types/pouchdb-core/package.json',
  '/project/server/node_modules/@types/pouchdb-find/package.json',
  '/project/server/node_modules/@types/serve-static/package.json',
}

Does this look like a @rollup/plugin-typescript or a TypeScript bug?

@RebeccaStevens
Copy link
Author

@michael42 It might be worth opening an issue on typescript's repo with your findings.

Kapelianovych added a commit to Kapelianovych/fluss-core that referenced this issue Aug 28, 2021
milahu added a commit to milahu/vite that referenced this issue Aug 30, 2021
milahu added a commit to milahu/vite that referenced this issue Aug 30, 2021
milahu added a commit to milahu/vite that referenced this issue Aug 30, 2021
aomarks added a commit to lit/lit that referenced this issue Aug 31, 2021
aomarks added a commit to lit/lit that referenced this issue Aug 31, 2021
@thobson
Copy link

thobson commented Sep 1, 2021

Same issue for me on 4.4.2

test.ts:
export const name = "test"

rollup.config.js:

export default {
  input: 'src/test.ts',
  output: {
    sourcemap: true,
    format: 'iife',
    name: 'test',
    file: 'public/dist/test.js'
  },
  plugins: [
    typescript()
  ]
}

Note: tsc src/test.ts works fine

Update: Downgrading typescript to 4.1.6 fixes the issue. Will wait for 4.4.3

@MartinJohns
Copy link

It'll be fixed with TypeScript 4.4.3. See microsoft/TypeScript#45633.

@jonkoops
Copy link
Contributor

jonkoops commented Sep 1, 2021

@RebeccaStevens since this is a confirmed issue with TypeScript itself I believe this issue can be closed.

@RebeccaStevens
Copy link
Author

Closing due to this being an upstream bug.

@loynoir
Copy link

loynoir commented Sep 4, 2021

Same error, downgrade to typescript@4.3.5 also work.

ShaneLucy added a commit to ShaneLucy/solar-system that referenced this issue Sep 5, 2021
MattiasBuelens added a commit to MattiasBuelens/web-streams-polyfill that referenced this issue Sep 5, 2021
HiDeoo added a commit to HiDeoo/Typedown that referenced this issue Sep 6, 2021
FlorianWendelborn added a commit to 3YOURMIND/kotti that referenced this issue Sep 7, 2021
TS 4.4.2 is unfortunately not possible yet, as there’s this rollup+typescript bug that will most likely be fixed in TS 4.4.3:

rollup/plugins#983
microsoft/TypeScript#45633
@shellscape
Copy link
Collaborator

Reopening this since we've got a number of people struggling to search issues and we're seeing an increase in duplicates on this one.

Note: To anyone viewing this issue, this is an upstream issue with TypeScript and not something we can control as noted in this comment #983 (comment)

Please do not add "same here," "me too", "+1" replies to this issue.

@shellscape shellscape reopened this Sep 10, 2021
@shellscape shellscape changed the title Rollup builds hang with typescript 4.4.2 (upstream TypeScript bug) Builds hang with typescript 4.4.2 Sep 10, 2021
@jonkoops
Copy link
Contributor

@andrewbranch Any chance that path version is going to be released soon? It seems this issue is gathering some massive attention.

@shellscape
Copy link
Collaborator

Please do your homework before pinging maintainers (those folks are stupid busy). He already addressed that here: microsoft/TypeScript#45642 (comment)

Please ask TypeScript maintainers questions in associated TypeScript project PRs or Issues.

@rollup rollup locked and limited conversation to collaborators Sep 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants