FredKSchott / rollup-plugin-polyfill-node

A modern Node.js polyfill for your Rollup bundle.
Other
175 stars 55 forks source link

Warning on build "Circular dependency polyfill-node.global.js -> polyfill-node.global.js" #34

Closed hey24sheep closed 2 years ago

hey24sheep commented 2 years ago

I am facing this warning when using rollup -c. What can I do to solve this?

Warning (!) Circular dependency polyfill-node.global.js -> polyfill-node.global.js

My config


export default {
    input: "src/index.js",
    output: [
        {
            format: "cjs",
            name: "dummy",
            file: "dist/dummy.cjs.js",
            globals: {
                "argon2-browser": "argon2",
                "path": "path",
                "fs": "fs",
            }
        },
        {
            format: "cjs",
            name: "dummy",
            file: "dist/dummy.cjs.min.js",
            plugins: [terser()],
            globals: {
                "argon2-browser": "argon2",
                "path": "path",
                "fs": "fs",
            }
        },
        {
            format: "umd",
            name: "dummy",
            file: "dist/dummy.umd.js",
            globals: {
                "argon2-browser": "argon2",
                "path": "path",
                "fs": "fs",
            }
        },
        {
            format: "umd",
            name: "dummy",
            file: "dist/dummy.umd.min.js",
            plugins: [terser()],
            globals: {
                "argon2-browser": "argon2",
                "path": "path",
                "fs": "fs",
            }
        },
        {
            format: "iife",
            name: "dummy",
            file: "dist/dummy.iife.js",
            globals: {
                "argon2-browser": "argon2",
                "path": "path",
                "fs": "fs",
            }
        },
        {
            format: "iife",
            name: "dummy",
            file: "dist/dummy.iife.min.js",
            plugins: [terser()],
            globals: {
                "argon2-browser": "argon2",
                "path": "path",
                "fs": "fs",
            }
        },
        {
            format: "es",
            name: "dummy",
            file: "dist/dummy.esm.js",
            globals: {
                "argon2-browser": "argon2",
                "path": "path",
                "fs": "fs",
            }
        },
        {
            format: "es",
            name: "dummy",
            file: "dist/dummy.esm.min.js",
            plugins: [terser()],
            globals: {
                "argon2-browser": "argon2",
                "path": "path",
                "fs": "fs",
            }
        },
    ],
    plugins: [
        wasm(),
        commonjs(),
        nodePolyfills(),
        nodeResolve({
            preferBuiltins: true,
            browser: true,
            // pass custom options to the resolve plugin
            moduleDirectories: [
                "node_modules"
            ],
        }),
    ],
};
joshocalico commented 2 years ago

This is literally resolved here. #17 This goes from an annoyance to actually breaking things in Vite and I'd presume it's not helpful in Snowpack either. Pinging a maintainer - @FredKSchott

joshocalico commented 2 years ago

If it's blocking, as it is for us - you're welcome to use this package. npm install -D @reputation.link/rollup-plugin-polyfill-node That will require the org scope in your import however.

FredKSchott commented 2 years ago

Fixed in #17. Apologies for the delay merging! If anyone uses this in their daily work and would like to help maintain, please let me know.