How to use the rollup function from rollup

Find comprehensive JavaScript rollup.rollup code examples handpicked from public code repositorys.

1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
const validateSchema = getSchemaValidationFunction('extract-cssdfn');

before(async () => {
  // Convert the JS module to a JS script that can be loaded in Puppeteer
  // without having to provide a URL for it (tests run in "about:blank" pages)
  const bundle = await rollup.rollup({
    input: path.resolve(__dirname, '../src/browserlib/extract-cssdfn.mjs')
  });
  const { output } = await bundle.generate({
    name: 'extractCSS',
fork icon24
star icon54
watch icon6

303
304
305
306
307
308
309
310
311
312

logTaskEnd(true);
logTaskStart('Building es5 bundle');

await configureLibTypescript(true, false, undefined, 'es5');
const bundleEs5 = await rollup.rollup(
  loadRollupConfig(
    packagePath,
    rootPackageDirectory,
    packageDirectory,
fork icon0
star icon1
watch icon12

+ 2 other calls in file

8
9
10
11
12
13
14
15
16
17
if (format === 'iife') outputOptions.name = '__BUNDLE_NAME__'
const plugins = [ vuePlugin(config) ]

let rollupBundle
try {
  rollupBundle = await rollup({
    input: filename,
    plugins,
    onwarn: warning => console.log('ROLLUP', filename, warning),
  })
fork icon0
star icon0
watch icon2

+ 7 other calls in file

30
31
32
33
34
35
36
37
38
39
console.log("Building JS SDK with Rollup...")
const {options, warnings} = await loadConfigFile(path.resolve(__dirname, 'rollup.config.js'), {format: 'es'});
console.log(`Rollup build currently have ${warnings.count} warnings`);
warnings.flush();
options.map(async option => {
    const bundle = await rollup.rollup(option)
    await Promise.all(option.output.map(bundle.write))
    rollup.watch(option).on('event', event => {
        if (event.code === 'BUNDLE_START') {
            console.log(`Building ${event.input}`);
fork icon0
star icon0
watch icon2

+ 3 other calls in file

160
161
162
163
164
165
166
167
168
169
    chalk.cyan.dim('\Bundling '),
    chalk.cyan(singleConfig.input)
);

console.time('rollup build');
const bundle = await rollup.rollup(singleConfig);

for (let output of singleConfig.output) {
    console.log(
        chalk.green.dim('Created '),
fork icon0
star icon0
watch icon1

12
13
14
15
16
17
18
19
20
21
22
23


function es(components, cb) {
  const env = process.env.NODE_ENV || 'development';


  // Bundle
  rollup.rollup({
    input: './src/swiper.js',
    external: ['dom7/dist/dom7.modular', 'ssr-window'],
    plugins: [
      replace({
fork icon0
star icon0
watch icon1

+ 7 other calls in file

173
174
175
176
177
178
179
180
181
182
    ...rollupOutputConfig
});
sh.echo(chalk.yellowBright(`  [${rollupTsconfig.tsconfigOverride.compilerOptions.target} & umd]: `) + chalk.greenBright(`${rollupInputConfig.input} → ${packagePaths.main}`));

rollupTsconfig.tsconfigOverride.compilerOptions.target = 'es6';
let es6esmBundle = await rollup.rollup({
    ...rollupInputConfig,
    plugins: [rollupTypeScript({ ...rollupTsconfig })].concat(rollupInputConfig.plugins)
});
await es6esmBundle.write({
fork icon0
star icon0
watch icon1

+ 9 other calls in file

70
71
72
73
74
75
76
77
78
79
80
let cache = {};


// Creates a bundle with broad browser support, exposed
// as UMD
gulp.task('js-es5', () => {
    return rollup({
        cache: cache.umd,
        input: 'js/index.js',
        plugins: [
            resolve(),
fork icon0
star icon0
watch icon0

+ 2 other calls in file

14
15
16
17
18
19
20
21
22
23
24
25
const configs = require('./configs');
const rollup = require('rollup');


configs.forEach(async function(config) {
  const { output: outputOptions, ...inputOption } = config;
  const bundle = await rollup.rollup(inputOption);


  if (!Array.isArray(outputOptions)) {
    outputOptions = [outputOptions];
  }
fork icon0
star icon0
watch icon0

383
384
385
386
387
388
389
390
391
392
    },
    chunkFileNames: 'shared.d.ts'
});

// Bundle all in one
const bundleAllInOne = await rollup.rollup({
    input: nodePath.resolve(__dirname, `../types/src/export/all.d.ts`),
    ...commonConfig
});
await bundleAllInOne.write({
fork icon0
star icon0
watch icon0

314
315
316
317
318
319
320
321
322
323
324
325


async function bundle() {
  const entryFileName = resolve(sourceDir, 'index.js');


  // Bundle all modules with rollup
  const result = await rollup.rollup({
    input: entryFileName,
    acornInjectPlugins: [jsx()],
    plugins: [
      rollupResolve(),
fork icon0
star icon0
watch icon0