From 55a48cfd089612980a405bb7f40157d3a17922e1 Mon Sep 17 00:00:00 2001 From: Jinbao1001 Date: Fri, 28 Jun 2024 17:14:17 +0800 Subject: [PATCH] fix: sourcecode incorrect compilation (#2154) --- src/loaders/markdown/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/loaders/markdown/index.ts b/src/loaders/markdown/index.ts index a09b1980a..c0ea3bc35 100644 --- a/src/loaders/markdown/index.ts +++ b/src/loaders/markdown/index.ts @@ -163,11 +163,14 @@ export const demos = { // skip un-existed source file, e.g. custom tech-stack return custom dependencies // skip non-file asset because resolveMap will contains all dependencies since 2.3.0 if (asset.dependencies[file]?.type === 'FILE') { + let assetValue = `{{{require('-!${resolveMap[file]}?dumi-raw').default}}}`; + // mako not support -! + if (process.env.OKAM) { + assetValue = `{{{require('${resolveMap[file]}?dumi-raw').default}}}`; + } // to avoid modify original asset object asset = lodash.cloneDeep(asset); - asset.dependencies[ - file - ].value = `{{{require('${resolveMap[file]}?dumi-raw').default}}}`; + asset.dependencies[file].value = assetValue; } });