Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda