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 JavaScript API usage example #3955

Closed
2 of 4 tasks
slavafomin opened this issue Feb 10, 2021 · 0 comments · Fixed by #4331
Closed
2 of 4 tasks

Rollup JavaScript API usage example #3955

slavafomin opened this issue Feb 10, 2021 · 0 comments · Fixed by #4331

Comments

@slavafomin
Copy link

slavafomin commented Feb 10, 2021

Documentation Is:

  • Missing
  • Needed
  • Confusing
  • Not Sure?

Please Explain in Detail...

The JavaScript API usage example looks too simplified. It lacks proper handling of multiple output formats and error handling.

Your Proposal for Changes

I would suggest to update the usage example to something along the lines:

let build: RollupBuild;
let buildFailed = false;

try {

  build = await rollup(input);

  // Generating multiple bundle types
  for (const outputOptions of outputs) {
    await build.write(outputOptions);
  }

} catch (error) {
  errorReporter(error);
  buildFailed = true;

} finally {
  if (build) {
    await build.close();
  }

}

process.exit(buildFailed ? 1 : 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant