๐ ice.js: The Progressive App Framework Based On React๏ผๅบไบ React ็ๆธ่ฟๅผๅบ็จๆกๆถ๏ผ
Patch: revert @swc/core version because of https://github.com/swc-project/swc/issues/7174
Support access /about/repo/$id
by create route component about.repo.$id.tsx
.
โโโ src
โโโ root.jsx
โโโ pages
- โโโ about
- โ โโโ repo
- โ โ โโโ $id.tsx
โ โโโ index.tsx
+ โโโ about.repo.$id.tsx
Remain route path by []
which matches routing rules, such as index
route component | route |
---|---|
src/pages/[index].tsx | /index |
src/pages/about/[index].tsx | /about/index |
Visit docs for more details.
server.onDemand
optional #6010Enable on demand compile by config ice.config.mts
:
import { defineConfig } from '@ice/app';
import SpeedMeasurePlugin from 'speed-measure-webpack-plugin';
import customPlugin from './plugin';
export default defineConfig(() => ({
ssr: true,
server: {
onDemand: true,
// Strongly recommand to set esm format when use on demand compilation.
format: 'esm',
},
}));
import { defineConfig } from '@ice/app';
export default defineConfig({
routes: {
config: [
{
path: 'rewrite',
// ไป src/page ๅผๅง่ฎก็ฎ่ทฏๅพ๏ผๅนถไธ้่ฆๅๅ็ผ
component: 'sales/layout.tsx',
children: [
{
path: '/favorites',
component: 'sales/favorites.tsx',
},
{
path: 'overview',
component: 'sales/overview.tsx',
},
{
path: 'recommends',
component: 'sales/recommends.tsx',
},
],
},
{
path: '/',
component: 'index.tsx',
},
],
},
});
We strongly recommend to use file system routing, which makes routes more predictable and intuitive.
@jsx createElement
comment. Thanks for the PR from @MrpandaLiurax-compat
#5999getRouteManifest
and flatten routes getFlattenRoutes
#5915.browserslist
do not works for code compilation #5906esm
#5935isServer
is false when compile dataLoader.js
#5897// New API from ice for Suspense SSR
import { useSuspenseData, withSuspense } from 'ice';
function Comments() {
const comments = useSuspenseData(getData);
return (
<div>
{comments.map((comment, i) => (
<p className="comment" key={i}>
{comment}
</p>
))}
</div>
);
}
export default withSuspense(Comments);
const fakeData = [
"Wait, it doesn't wait for React to load?",
'How does this even work?',
'I like marshmallows',
];
async function getData() {
await new Promise((resolve) => {
setTimeout(() => resolve(null), 3000);
});
return fakeData;
}
rax compat mode
#5847@ice/plugin-icestark
#5825data-loader.js
#5843import.meta.target
, import.meta.renderer
and import.meta.env.*
#5700routes.injectInitialEntry
#5800Enable routes.injectInitialEntry
when deploy memory router app by assets:
import { defineConfig } from '@ice/app';
export default defineConfig(() => ({
splitChunks: false,
routes: {
injectInitialEntry: true,
},
}));
ObjectProperties
when disable ssg for document render #5785HotFix: bump @swc/helpers version to fix compile error #5768
data-loader.js
to lower es version #5758