Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!