From 5cde38b0611f2dd28fb1bfb49e34ad1d3a910390 Mon Sep 17 00:00:00 2001 From: Jinbao1001 Date: Fri, 26 Apr 2024 15:01:50 +0800 Subject: [PATCH] fix: workaround for resolve esm package in code block demo (#2082) (#2083) --- src/features/compile/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/features/compile/index.ts b/src/features/compile/index.ts index 9c7e7473e..488533b41 100644 --- a/src/features/compile/index.ts +++ b/src/features/compile/index.ts @@ -71,6 +71,12 @@ export default (api: IApi) => { api.chainWebpack(async (memo) => { const babelInUmi = memo.module.rule('src').use('babel-loader').entries(); const loaderPath = require.resolve('../../loaders/markdown'); + + // support require mjs packages(eg. element-plus/es) + memo.resolve.merge({ + conditionNames: ['require', 'node', 'import'], + }); + const loaderBaseOpts: Partial = { techStacks, cwd: api.cwd,