rollup / rollup-plugin-commonjs

This module has moved and is now available at @rollup/plugin-commonjs / https://github.com/rollup/plugins/blob/master/packages/commonjs
MIT License
501 stars 126 forks source link

'inherits' is not exported by node_modules/util/util.js #393

Closed srepollock closed 5 years ago

srepollock commented 5 years ago

Running into an error with Inherits not being exported by node_modules/util/util.js.

Rollup Config

import typescript from 'rollup-plugin-typescript2';
import babel from 'rollup-plugin-babel';
import globals from 'rollup-plugin-node-globals';
import builtins from 'rollup-plugin-node-builtins';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from "rollup-plugin-commonjs";
import pkg from "./package.json";

export default {
    input: './src/index.ts',
    plugins: [
        typescript(),
        resolve({
            preferBuiltins: true,
            browser: true
        }),
        commonjs({
            include: "node_modules/*",
        }),
        builtins(),
        globals({
            process: true,
            global: true,
            dirname: true,
            filename: true
        }),
        babel(),
    ],
    output: [ // Required; Array = multiple outputs
        {
            file: pkg.main,
            format: 'umd',
            name: 'Divine'
        },
        {
            file: "lib/divine.cjs.js",
            format: 'cjs'
        },
        {
            file: pkg.module,
            format: 'es'
        }
    ],
    watch: {
        include: [
            "src/**/*.ts"
        ],
        exclude: [

        ]
    }
}

I have used the following fixes to no avail:

  1. Reordered plugin support
  2. Updated commonjs to the following:
        commonjs({
            include: "node_modules/*",
            namedExports: {
                "node_modules/util/util.js": ['inherits']
            }
        }),

Has anyone else seen a similar issue? I can't seem to find more on the web at this time. Thank you for all the help in advance!

bterlson commented 5 years ago

This could be related to #394. You can try downgrading resolve to 1.11.0 and see if it helps.

srepollock commented 5 years ago

That did solve the issue. thanks @bterlson