Package Exports
- isomorphic-undici
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (isomorphic-undici) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
isomorphic-undici
Isomorphic exports of fetch, providing window.fetch in the browser and undici.fetch in node.js.
npm install isomorphic-undiciUsage
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):
- the external dependency
"stream/web" - experiments
asyncWebAssembly: true - add
webassembly-loader(npm i webassembly-loader)
example
externals: {
'stream/web': 'commonjs stream/web',
},
experiments: {
asyncWebAssembly: true,
},
rules: [
{
test: /\.wasm$/,
type: 'javascript/auto',
use: [
{
loader: 'webassembly-loader',
options: {
export: 'buffer', // only buffer
},
},
],
},
],License
MIT