Skip to content

Incompatibility with Rollup/Vite process polyfill #539

Open
@WasabiThumb

Description

@WasabiThumb

Similar to #450, though in this case a polyfill is present. It looks like the process polyfill is an ES module with a default export that isn't being properly unwrapped by readable-stream.

I've set a breakpoint on the line that is causing TypeError: e.nextTick is not a function:
image

I can confirm that a nextTick implementation is available at both the default and process fields. Here my vite.config.ts:

import {defineConfig} from "vite";
import {nodePolyfills} from "vite-plugin-node-polyfills";

export default defineConfig({
    mode: 'development',
    build: {
        sourcemap: true
    },
    plugins: [
        nodePolyfills() // also tried: { globals: { process: true } }
    ]
});
Package Version
readable-stream ^4.5.2
vite ^5.4.2
vite-plugin-node-polyfills ^0.22.0
rollup ^4.21.0
esbuild ^0.23.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions