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

Rollup doesn't exit correclty within a prepublishOnly lifecycle #4998

Closed
weaintplastic opened this issue May 17, 2023 · 4 comments · Fixed by #5004
Closed

Rollup doesn't exit correclty within a prepublishOnly lifecycle #4998

weaintplastic opened this issue May 17, 2023 · 4 comments · Fixed by #5004

Comments

@weaintplastic
Copy link

Rollup Version

3.21.3

Operating System (or Browser)

Mac OS

Node Version (if applicable)

16

Link To Reproduction

https://stackblitz.com/edit/node-7qf5yb?file=package.json,rollup.config.js,index.js

Expected Behaviour

Given npm scripts that are structured like this:

"scripts": {
    "build": "npm run build.job1 && npm run build.job2 && npm run build.job3",
    "build.job1": "echo job 1",
    "build.job2": "rollup -c --bundleConfigAsCjs",
    "build.job3": "echo job 2",
    "prepublishOnly": "npm run build"
  }

It's expected that all build jobs (1, 2, 3) are executed and terminated correctly when calling npm run build or when they are called as part of npm's publishing lifecycle through prepublishOnly.

Actual Behaviour

Starting with version 3.21.3 we notice some unexpected behavior.

All build jobs (1, 2, 3) are running and terminated as expected when running them with npm run build directly.
Though when their execution is part of the prepublishOnly lifecycle, things are getting odd:

  • npm run build.job3 is never called
  • npm is publishing the package too early. The process is kicked off the moment npm run build.job2 (which is executing rollup) seems to have finished its job but somehow hasn't terminated correctly

I've tried to create a reproduction example but without the whole npm ecosystem set up with a package that actually can be published, it's quite hard to create such case.

I'm happy to ramp up a whole setup if needed to inspect this issue in more depth. Buth maybe the behavior I described does already ring a bell 🤞

@lukastaegert
Copy link
Member

Probably related to #4995. I think we will need to rollback some fixes but I fear it will not be before Friday night when I can publish this.

@weaintplastic
Copy link
Author

No worries @lukastaegert. Thanks for picking this up so quickly. I'll pin the dependency for now.

@lukastaegert
Copy link
Member

Fix at #5004

@rollup-bot
Copy link
Collaborator

This issue has been resolved via #5004 as part of rollup@3.22.1. You can test it via npm install rollup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants