diff --git a/src/assetParsers/block.ts b/src/assetParsers/block.ts index 9ae8c044e..e44594147 100644 --- a/src/assetParsers/block.ts +++ b/src/assetParsers/block.ts @@ -80,7 +80,7 @@ async function parseBlockAsset(opts: { value: pkg.version, }; - result.resolveMap[args.path] = resolved; + result.resolveMap[args.path] = args.path; } // make all deps external @@ -179,7 +179,10 @@ async function parseBlockAsset(opts: { // save file absolute path for load file via raw-loader // to avoid bundle same file to save bundle size - if (!isEntryPoint || !opts.entryPointCode) { + if ( + opts.techStack.runtimeOpts && + (!isEntryPoint || !opts.entryPointCode) + ) { result.resolveMap[filename] = args.path; } diff --git a/src/client/theme-api/useLiveDemo.ts b/src/client/theme-api/useLiveDemo.ts index b3f6e1b38..c9cb8cef9 100644 --- a/src/client/theme-api/useLiveDemo.ts +++ b/src/client/theme-api/useLiveDemo.ts @@ -170,7 +170,18 @@ export const useLiveDemo = ( oError.apply(console, args); // check component is able to render, to avoid show react overlay error - (await renderToStaticMarkupDeferred)(newDemoNode); + try { + (await renderToStaticMarkupDeferred)(newDemoNode); + } catch (err: any) { + const shouldSkipError = + err.message.includes( + 'Unable to find node on an unmounted component', + ) || + err.message.includes( + 'Portals are not currently supported by the server renderer', + ); + if (!shouldSkipError) throw err; + } console.error = oError; // set new demo node with passing source diff --git a/src/loaders/markdown/index.ts b/src/loaders/markdown/index.ts index d8a07dc53..3881c947f 100644 --- a/src/loaders/markdown/index.ts +++ b/src/loaders/markdown/index.ts @@ -2,6 +2,7 @@ import { isTabRouteFile } from '@/features/tabs'; import type { IThemeLoadResult } from '@/features/theme/loader'; import { generateMetaChunkName, getCache, getContentHash } from '@/utils'; import fs from 'fs'; +import path from 'path'; import { Mustache, lodash, winPath } from 'umi/plugin-utils'; import transform, { type IMdTransformerOptions, @@ -58,7 +59,9 @@ export type IMdLoaderOptions = function getDemoSourceFiles(demos: IMdTransformerResult['meta']['demos'] = []) { return demos.reduce((ret, demo) => { if ('resolveMap' in demo) { - ret.push(...Object.values(demo.resolveMap)); + ret.push( + ...Object.values(demo.resolveMap).filter((p) => path.isAbsolute(p)), + ); } return ret; diff --git a/suites/theme-mobile/src/builtins/Previewer/index.less b/suites/theme-mobile/src/builtins/Previewer/index.less index 0fc401239..39e949bb2 100644 --- a/suites/theme-mobile/src/builtins/Previewer/index.less +++ b/suites/theme-mobile/src/builtins/Previewer/index.less @@ -42,7 +42,7 @@ &:first-child + .dumi-default-previewer-sources { border-top: 1px dashed @c-border-light; margin-top: 42px; - + overflow: auto; @{dark-selector} & { border-top-color: @c-border-less-dark; }