2022-01-08 13:42:59 -03:00

3.3 KiB

Installing

Minified Size Install Size

At 0.7.8, this library got tuned to be more smaller, so it provides 5 different bundling options.

With Npm

# Npm
npm install --save axios axios-cache-interceptor

# Yarn
yarn add axios axios-cache-interceptor
const { setupCache } = require('axios-cache-interceptor');
import { setupCache } from 'axios-cache-interceptor';

With CDNs

const { setupCache } = window.AxiosCacheInterceptor;
<!-- Replace latest with the desired version -->

<!-- Development for ES2020+ (~30.0KB) -->
<script
  src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.0/dist/index.development.js"
  integrity="sha256-oEvQQcJv78S8QSJOY6XQ2uJ2dGwnnhAsYLDeXx0DHWA="
  crossorigin="anonymous"
></script>

<!-- Production for ES6+ (~11.3KB) -->
<script
  src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.0/dist/index.min.js"
  integrity="sha256-vtHJnEYMjzfFDDPBAic56ppjVrN6ze2qi7wXM9a/BSM="
  crossorigin="anonymous"
></script>

<!-- Production for ES5+ (~18.2KB) -->
<script
  src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.0/dist/index.es5.min.js"
  integrity="sha256-R/q1PnksvXhveo9qidplrGvGGsmFDAsal9M6bUfnNS4="
  crossorigin="anonymous"
></script>

<!-- Production for ES2020+ (~9.2KB) -->
<script
  src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.0/dist/index.es2020.min.js"
  integrity="sha256-amiYeGe9088KbQ+4xF0/9tNP+ks4Ze5LF6cZ7aiow3Q="
  crossorigin="anonymous"
></script>

With URL imports

You can import any CDN Url and use it in your code. UMD Compatible

import { setupCache } from 'https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.0/dist/index.es2020.min.js';

Support List

Below you can check what version of this package is supported by your version of axios. But that does not mean that won't work with any version. Most of "breaking changes" made by axios was it's types.

Note

: Below v0.3, axios was not configured as a peer dependency

Version Axios
>= v0.5 >= v0.24
~ v0.4 >= v0.23
~ v0.3 >= v0.22
<= v0.2 v0.21