Skip to content

No polyfills for node modules http and https with Webpack 5 (via CRA 5) #254

Closed
@illume

Description

@illume

Hello!

I upgraded to Create React App 5 recently, which newly uses Webpack 5.

Now Webpack 5 is not automagically doing polyfills for node modules anymore.

The errors are something like this (I cut out a lot of noise):

ERROR in ./node_modules/@apidevtools/json-schema-ref-parser/lib/resolvers/http.js 3:13-28
  Module not found: Error: Can't resolve 'http' in '/home/xxx/node_modules/@apidevtools/json-schema-ref-parser/lib/resolvers'
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
          - install 'stream-http'

ERROR in ./node_modules/@apidevtools/json-schema-ref-parser/lib/resolvers/http.js 5:14-30
  Module not found: Error: Can't resolve 'https' in '/home/xxx/node_modules/@apidevtools/json-schema-ref-parser/lib/resolvers'
  If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
    - install 'https-browserify'

Is it possible to make @apidevtools/json-schema-ref-parser work with browsers somehow?

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