在导出的数组中,仅有一个配置的滚动观察

问题描述 投票:0回答:1

有人知道,我怎么只能看一个数组的配置,我已经导出了,通过输入 rollup -c -w 而只需输入 rollup -c 它将编译成4个不同的版本?这意味着,如果我观察js文件,它只为我编译一个配置,例如cjs的那个。我已经试过了,把watch设置为false,但是没有用,我想两个不同的文件是很愚蠢的。有人有一个想法到这?这是我的实际配置。

// 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/**',
            }),
        ],
    },
];
javascript configuration rollupjs
1个回答
0
投票

好吧,这个函数还不存在,但我现在已经开始了一个问题。https:/github.com rolluprollupissues3607

© www.soinside.com 2019 - 2024. All rights reserved.