Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

150
Vistas
Rollup is importing util

I am building a library to be used to call api's

I am using rollup to bundle all the files into one file, the issue is its adding this line

import util from 'util';

not sure what it does, I am not using anything from util

below is my rollup config file

import nodeGlobals from "rollup-plugin-node-globals";
import commonjs from "rollup-plugin-commonjs";
import uglify from "rollup-plugin-uglify";
import babel from "rollup-plugin-babel";
import replace from "rollup-plugin-replace";
import resolve from "rollup-plugin-node-resolve";
import rollupJson from "rollup-plugin-json";

export default [
    {
        input: 'src/config.js',
        output: [
            {
                name:"asd",
                file: 'dist/bundle-b2.js',
                format: 'es',
            }
        ],
        plugins: [
            babel({
                babelrc: false,
                presets: [
                    ["airbnb",{"modules":false}],
                    ["env",{"modules":false,"useBuiltIns": false}],
                    ["es2015",{"modules":false}],
                    ['stage-2']],
                exclude:[
                    'node_modules/**',
                ],
                plugins: ['external-helpers', ["transform-builtin-extend", {
                    globals: ["Error", "Array"],
                }]],
                externalHelpers: true,
                runtimeHelpers: true,

            }),
            resolve({
                jsnext: true,
                preferBuiltins: true,
                browser: true,
            }),
            commonjs({
                include: 'node_modules/**'
            }),
            nodeGlobals(
                {
                    process:true,
                    global:false,
                    Buffer:false
                }
            ),

            rollupJson({compact: true
            }),

            replace({
                'process.env.NODE_ENV': JSON.stringify('production'),
            }),
        ]
    }
];

any help please ?

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Probably what is happening is one of your dependencies uses NodeJS's util built-in library. Even though you don't use util and you might not even use functionality from that dependency that uses util, Rollup still adds the import to the bundle.

If that is indeed the case, you'll need another plugin (like rollup-plugin-polyfill-node) that can handle these imports and give you something that either mimics or at least fakes functionality so that the build can complete properly.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda