rollup / rollupjs.org

Rollup demo website
http://rollupjs.org
77 stars 86 forks source link

Rollup watch only one config in exported array #203

Closed luwol03 closed 4 years ago

luwol03 commented 4 years ago

does somebody know, how I can only watch one config of an array, witch I have exported, by typing rollup -c -w and by typing only rollup -c it will compile it to 4 different versions? That means, if I will watch the js files, it compiles only one config for me e.g. the cjs one. I have already tried, to set watch to false, but it doesn't work and I think two different files are to stupid. Have somebody an idea to to this? This is my actual config:

// rollup.config.js
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';

import pkg from './package.json';

export default [
    {
        input: 'src/main.js',
        output: {
            file: pkg.main,
            format: 'cjs',
        },
        watch: {
            exclude: ['node_modules/'],
        },
        plugins: [
            resolve(),
            commonjs(),
            babel({
                exclude: 'node_modules/**',
                babelrc: false,
                presets: [
                    [
                        '@babel/env',
                        {
                            modules: false,
                            useBuiltIns: 'usage',
                            targets: 'maintained node versions',
                            corejs: '3.6.5',
                        },
                    ],
                ],
            }),
        ],
    },
    {
        input: 'src/main.js',
        output: {
            file: pkg.browser,
            format: 'umd',
            name: 'eatFruit',
        },
        plugins: [
            resolve(),
            commonjs(),
            babel({
                exclude: 'node_modules/**',
            }),
        ],
    },
    {
        input: 'src/main.js',
        output: {
            file: pkg.browser.replace(/\.js$/, '.min.js'),
            format: 'umd',
            name: 'eatFruit',
        },
        plugins: [
            resolve(),
            commonjs(),
            babel({
                exclude: 'node_modules/**',
            }),
            terser(),
        ],
    },
    {
        input: 'src/main.js',
        output: {
            file: pkg.module,
            format: 'es',
        },
        plugins: [
            resolve(),
            commonjs(),
            babel({
                exclude: 'node_modules/**',
            }),
        ],
    },
];
luwol03 commented 4 years ago

Oh, sorry wrong repo.