mirror of
https://github.com/arthurfiorette/axios-cache-interceptor.git
synced 2025-12-08 17:36:16 +00:00
3.6 KiB
3.6 KiB
Installing
With Npm
# Npm
npm install --save axios axios-cache-interceptor
# Yarn
yarn add axios axios-cache-interceptor
// CommonJS
const { setupCache } = require('axios-cache-interceptor');
import { setupCache } from 'axios-cache-interceptor';
// ES Modules
import { setupCache } from 'axios-cache-interceptor/esm';
// Universal (UMD)
const { setupCache } = require('axios-cache-interceptor/umd');
With CDN
<!-- Development build for ES2020+ (~11.2 KiB) -->
<script
src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.9.3/umd/dev.js"
integrity="sha256-rA/FnVuUARurz1Bf4Z39FYKwRxwof9EyDXUvNXpme7Y="
crossorigin="anonymous"
></script>
<!-- Production for ES2017+ (~9.74 KiB) -->
<script
src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.9.3/umd/index.js"
integrity="sha256-j8ypa8+fqXmln3IeNAFQt5ptzfkOettceB7qQmIDIW4="
crossorigin="anonymous"
></script>
<!-- Production for ES5+ (~13.9 KiB) (Needs Promise polyfill) -->
<script
src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.9.3/umd/es5.js"
integrity="sha256-UCAsKcSsVNscI3Zydh5pmQt3QtRdLP4cF4rUwq0KLDY="
crossorigin="anonymous"
></script>
const { setupCache } = window.AxiosCacheInterceptor;
With URL imports
You can import any CDN Url and use it in your code. UMD Compatible
// ESM with Skypack CDN
import { setupCache } from 'https://cdn.skypack.dev/axios-cache-interceptor@0.9.3';
// UMD with JSDeliver CDN
import { setupCache } from 'https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.9.3/umd/index.js';
Official support table
Below you can check what version of this package is supported by your version of axios. But that does not mean that it won't work.. Axios had many "breaking changes" made with type declarations. But remember, new features and bug fixes only comes with newer versions. Please keep your dependencies up to date <3.
Note
: Axios is not defined as a
peerDependency, because it has a non-stable semver version (0.x.y). See #145 (Comment)
| Axios Cache Interceptor | Axios |
|---|---|
>= v0.8.4 |
>= v0.26 |
~ v0.8.4 |
~ v0.25 |
>= v0.5 && <= 0.8.3 |
~ v0.24 |
~ v0.4 |
~ v0.23 |
~ v0.3 |
~ v0.22 |
<= v0.2 |
v0.21 |