1// vite.config.js
2import legacy from '@vitejs/plugin-legacy'
3import { defineConfig } from 'vite'
4
5export default defineConfig({
6 plugins: [
7 legacy({
8 targets: ['defaults', 'not IE 11'],
9 }),
10 ],
11})
1export default function Loading() {
2 return <p>Loading...</p>;
3}
1async function getItem() {
2 // The `fetch` function is automatically memoized and the result
3 // is cached
4 const res = await fetch('https://.../item/1')
5 return res.json()
6}
7
8// This function is called twice, but only executed the first time
9const item = await getItem() // cache MISS
10
11// The second call could be anywhere in your route
12const item = await getItem() // cache HIT
1// vite.config.js
2import legacy from '@vitejs/plugin-legacy'
3import { defineConfig } from 'vite'
4
5export default defineConfig({
6 plugins: [
7 legacy({
8 targets: ['defaults', 'not IE 11'],
9 }),
10 ],
11})
1// vite.config.js
2import legacy from '@vitejs/plugin-legacy'
3import { defineConfig } from 'vite'
4
5export default defineConfig({
6 plugins: [
7 legacy({
8 targets: ['defaults', 'not IE 11'],
9 }),
10 ],
11})
1export default function Loading() {
2 return <p>Loading...</p>;
3}