Skip to content

Commit

Permalink
fix: demo should export html file (#1931)
Browse files Browse the repository at this point in the history
* fix: demo should export html file

* chore: code clean
  • Loading branch information
MadCcc authored Oct 8, 2023
1 parent 898a39a commit 5ef7c33
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/features/compile/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { IDemoLoaderOptions } from '@/loaders/demo';
import type { IMdLoaderOptions } from '@/loaders/markdown';
import ReactTechStack from '@/techStacks/react';
import type { IApi, IDumiTechStack } from '@/types';
import { addAtomMeta, addExampleAssets } from '../assets';

export default (api: IApi) => {
api.describe({ key: 'dumi:compile' });
Expand Down Expand Up @@ -109,6 +110,18 @@ export default (api: IApi) => {
.options({
...loaderBaseOpts,
builtins: api.service.themeData.builtins,
onResolveDemos(demos) {
const assets = demos.reduce<Parameters<typeof addExampleAssets>[0]>(
(ret, demo) => {
if ('asset' in demo) ret.push(demo.asset);
return ret;
},
[],
);

addExampleAssets(assets);
},
onResolveAtomMeta: addAtomMeta,
} as IMdLoaderOptions);

// get meta for each page component
Expand Down

0 comments on commit 5ef7c33

Please sign in to comment.