1.0.9 • Published 3 years ago

isomorphic-undici v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

isomorphic-undici

Isomorphic exports of fetch, providing window.fetch in the browser and undici.fetch in node.js.

npm install isomorphic-undici

Usage

import fetch from 'isomorphic-undici';

Why

undici fetch reduces request processing time by ~ 50-60%

Requirements

Node 16+

To use with webpack, you need to add to your webpack config for node (target:node):

  • webpack >=v5.53 or add the external dependency "stream/web"
  • experiments asyncWebAssembly: true
  • add webassembly-loader (npm i webassembly-loader)

example

  externals: {
    'stream/web': 'commonjs stream/web', // for webpack lowest than v5.53
  },
  experiments: {
    asyncWebAssembly: true,
  },
  rules: [
    {
      test: /\.wasm$/,
      type: 'javascript/auto',
      use: [
        {
          loader: 'webassembly-loader',
          options: {
            export: 'buffer', // only buffer
          },
        },
      ],
    },
  ],

License

MIT

1.0.9

3 years ago

1.0.2

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago