alibaba / ice

🚀 ice.js: The Progressive App Framework Based On React(基于 React 的渐进式应用框架)
https://ice.work
MIT License
17.83k stars 2.09k forks source link

feat: dynamic API #6831

Closed HomyeeKing closed 6 months ago

HomyeeKing commented 6 months ago

A API like next/dynamic but implemented with fully React API

Usage

import { dynamic } from 'ice';

const Foo = dynamic(() => import('foo'), {
    // support fallback before loading foo
    fallback: () => <div>fallback</div>,
    // default is true, you can set false to disable server side rendering 
    ssr: true
});

// or just import 
const Foo =  dynamic(import('foo'),{
    // ...
})

export default () => {
  return <Foo />;
};

Limit

ClarkXia commented 6 months ago

Run npm run rebuild to update pnpm-lock.yaml.

HomyeeKing commented 6 months ago

done

codecov-commenter commented 6 months ago

Codecov Report

Attention: Patch coverage is 43.85965% with 32 lines in your changes are missing coverage. Please review.

Project coverage is 79.08%. Comparing base (1989fc1) to head (8ce9d28). Report is 6 commits behind head on release/next.

Files Patch % Lines
packages/runtime/src/dynamic.tsx 40.74% 32 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## release/next #6831 +/- ## ================================================ - Coverage 79.45% 79.08% -0.38% ================================================ Files 219 221 +2 Lines 19473 19714 +241 Branches 2501 2506 +5 ================================================ + Hits 15473 15591 +118 - Misses 3963 4085 +122 - Partials 37 38 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

luhc228 commented 6 months ago

可以加下文档。Thanks @HomyeeKing