Skip to content

Conversation

nathancahill
Copy link
Contributor

This PR adds support for rolling multiple bundles (with their own configs, or at least with their own entry/dest options) in parallel. rollup.config.js can now export an array of objects, or a single object.

@nathancahill
Copy link
Contributor Author

This is how I manually handle #372 until there is a better solution in Rollup internals.

@Rich-Harris
Copy link
Contributor

This is great, thank you! Even works in --watch mode 🤘

@ghost
Copy link

ghost commented Jun 4, 2017

Here's a pattern some may wish to use to leverage this feature to produce minified bundles without duplicating config:

import uglify from 'rollup-plugin-uglify'
import { minify } from 'uglify-es'
const activeConfigs = [ /* array of rollup config objects */ ]
const minifiedConfigs = activeConfigs.reduce(
  (minifiedConfigs, activeConfig) => minifiedConfigs.concat(
    Object.assign({}, activeConfig, {
      plugins: [uglify({}, minify), ...activeConfig.plugins],
      dest: activeConfig.dest.replace('js', 'min.js')
    })
  ),
  []
)
export default activeConfigs.concat(minifiedConfigs)

Assumes activeConfigs define a plugin array.

And here's what it looks like in the context of a production module without Babel.

@nathancahill nathancahill deleted the features/multiple-configs branch June 7, 2017 17:12
@agraves agraves mentioned this pull request Jul 18, 2019
14 tasks
@fregante fregante mentioned this pull request Apr 21, 2020
vhscom added a commit to vhscom/fetch-inject that referenced this pull request Mar 5, 2022
vhscom added a commit to vhscom/fetch-inject that referenced this pull request Mar 5, 2022
vhscom added a commit to vhscom/fetch-inject that referenced this pull request Mar 5, 2022
vhscom added a commit to vhscom/fetch-inject that referenced this pull request Mar 5, 2022
vhscom added a commit to vhscom/fetch-inject that referenced this pull request Mar 5, 2022
vhscom added a commit to vhscom/fetch-inject that referenced this pull request Mar 5, 2022
@ProLoser
Copy link

What should we do if we want to build a bunch of assets in parallel but we want to host 1 webserver that contains multiple landing pages that are artifacts of the parallel builds?

Should I just configure ONE of the parallel builds with the webserver? Will livereload be triggered across parallel builds?

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 this pull request may close these issues.

3 participants