ice-lab / ice-next

The repo was transferred to https://github.com/alibaba/ice
https://v3.ice.work/
MIT License
53 stars 7 forks source link

Feat/static prefetch #611

Closed answershuto closed 2 years ago

answershuto commented 2 years ago

getData support static prefetch for web.

export const getData = {
  "key": "key_1",
  "prefetchType": "mtop",
  "api": "mtop.tmall.kangaroo.core.service.route.pagerecommendservice",
  "v": "1.0",
  "data": {
    "param1": "v1",
    "param2": "v2"
  },
  "extHeaders": {
    "nameAaaa": "112233"
  }
};
const plugin = () => ({
  name: 'plugin-mtop-prefetch',
  setup: ({ generator }) => {
    generator.addDataLoaderImport({
      source: '@ali/universal-mtop',
      exportAlias: {
        request: 'fetcher',
      },
      specifier: ['request'],
    });
  },
});

export default plugin;
vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
ice-v3 ✅ Ready (Inspect) Visit Preview Oct 21, 2022 at 7:37AM (UTC)