Run multiple fetch with limited concurrency
Install and add nuxt-parallel-limit to your nuxt.config.
npm install -D nuxt-parallel-limit
yarn add -D nuxt-parallel-limit
pnpm add -D nuxt-parallel-limit
export default defineNuxtConfig({
modules: ['nuxt-parallel-limit'],
})
You can pass configuration to the module in the nuxt.config like following:
export default defineNuxtConfig({
modules: ['nuxt-parallel-limit'],
parallelLimit: {
patterns: [
{
pattern: 'https://jsonplaceholder.typicode.com',
limit: 2
}
]
},
})
pattern:
stringpattern specifies a regular expression the fetch url should match. If the fetch url matches the specified pattern, the fetch will be limited by the limit attribute.limit:
numberpnpm dev:prepareMade with ❤️
Published under the MIT License.
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.