Rollup: It's confused about the props of JavaScript API not include output

Created on 4 Jan 2019  ·  3Comments  ·  Source: rollup/rollup

When I use JavaScript API rollup.rollup, maybe I'll do this config as follow:

async function build() {
  const result = await rollup({
    input: ...,
  })
  await result.write({
    output: {...}
  })
}

but the implementation of the api not include the output prop. It result in the difference between the JavaScript API and the configuration files.

// configuration files
module.exports = {
  input: 'src/main.js',
  output: {
    file: 'bundle.js',
    format: 'cjs'
  }
};

I really trouble in this case. Why not unify the api between them?

c⁵ ⋅ question

All 3 comments

From our perspective, the API is unified in that

Note that it would not make any sense to pass a full options object containing both input and output options similar to a config file to bundle.write as everything relying on input options has already happened at that point. Thus passing something with an output prop would be rather useless.

Obviously the documentation did not make this clear enough so suggestions on where to improve are always welcome!

I understand. But the small difference between them maybe trouble to the users who use them first time.:smile:

Maybe need more cases to introduce them.

Hey folks. This is a saved-form message, but rest assured we mean every word. The Rollup team is attempting to clean up the Issues backlog in the hopes that the active and still-needed, still-relevant issues bubble up to the surface. With that, we're closing issues that have been open for an eon or two, and have gone stale like pirate hard-tack without activity.

We really appreciate the folks have taken the time to open and comment on this issue. Please don't confuse this closure with us not caring or dismissing your issue, feature request, discussion, or report. The issue will still be here, just in a closed state. If the issue pertains to a bug, please re-test for the bug on the latest version of Rollup and if present, please tag @shellscape and request a re-open, and we'll be happy to oblige.

Was this page helpful?
0 / 5 - 0 ratings