FredKSchott / rollup-plugin-polyfill-node

A modern Node.js polyfill for your Rollup bundle.
Other
177 stars 57 forks source link

'Readable' is not exported by node_modules/stream/index.js, imported by polyfill-node.__http-lib/response.js #31

Closed lemoustachiste closed 3 years ago

lemoustachiste commented 3 years ago

I am getting this error when starting my project:


[!] Error: 'Readable' is not exported by node_modules/stream/index.js, imported by polyfill-node.__http-lib/response.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
polyfill-node.__http-lib/response.js (3:8)
1: import {overrideMimeType} from './capability';
2: import {inherits} from 'util';
3: import {Readable} from 'stream';
           ^
4:
5: var rStates = {
Error: 'Readable' is not exported by node_modules/stream/index.js, imported by polyfill-node.__http-lib/response.js
    at error (/Users/project/node_modules/rollup/dist/shared/rollup.js:5309:30)
    at Module.error (/Users/project/node_modules/rollup/dist/shared/rollup.js:9765:16)
    at Module.traceVariable (/Users/project/node_modules/rollup/dist/shared/rollup.js:10151:29)
    at ModuleScope.findVariable (/Users/project/node_modules/rollup/dist/shared/rollup.js:8905:39)
    at FunctionScope.findVariable (/Users/project/node_modules/rollup/dist/shared/rollup.js:2636:38)
    at ChildScope.findVariable (/Users/project/node_modules/rollup/dist/shared/rollup.js:2636:38)
    at MemberExpression.bind (/Users/project/node_modules/rollup/dist/shared/rollup.js:6576:49)
    at CallExpression.bind (/Users/project/node_modules/rollup/dist/shared/rollup.js:2723:23)
    at CallExpression.bind (/Users/project/node_modules/rollup/dist/shared/rollup.js:6767:15)
    at ExpressionStatement.bind (/Users/project/node_modules/rollup/dist/shared/rollup.js:2723:23)

These are the plugins I am using:

import serve from 'rollup-plugin-serve';
import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript';
import livereload from 'rollup-plugin-livereload';
import json from '@rollup/plugin-json';
import polyfills from 'rollup-plugin-polyfill-node';

plugins: [
      typescript(),
      resolve({
        browser: true,
        preferBuiltins: true
      }),
      json(),
      polyfills(),
      serve({
        contentBase: [BUILD_OUTPUT_FOLDER, 'demo', 'node_modules', 'dist', 'test/fixtures'],
        host: '0.0.0.0',
        port: 8081,
        open: true,
        https: {
          cert: fs.readFileSync(`${BUILD_OUTPUT_FOLDER}/https-cert/cert.pem`),
          key: fs.readFileSync(`${BUILD_OUTPUT_FOLDER}/https-cert/key.pem`)
        }
      }),
      livereload({
        watch: BUILD_OUTPUT_FOLDER
      })
    ]
lemoustachiste commented 3 years ago

One of the dependencies of my project is this one: https://github.com/juliangruber/stream. So I assume there is some sort of collusion. Is there a workaround in such case?