Skip to content

Commit

Permalink
fix: limit the resolve rule to the demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwcx committed Jun 14, 2024
1 parent 04d45f9 commit 69c741d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/features/compile/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ export default (api: IApi) => {
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.byDependency.set('commonjs', {
conditionNames: ['require', 'node', 'import'],
});

const loaderBaseOpts: Partial<IMdLoaderOptions> = {
techStacks,
cwd: api.cwd,
Expand Down Expand Up @@ -111,6 +106,12 @@ export default (api: IApi) => {
mdRule
.oneOf('md-demo')
.resourceQuery(/demo$/)
// support require mjs packages(eg. element-plus/es)
.resolve.byDependency.set('commonjs', {
conditionNames: ['require', 'node', 'import'],
})
.end()
.end()
.use('babel-loader')
.loader(babelInUmi.loader)
.options(babelInUmi.options)
Expand Down

0 comments on commit 69c741d

Please sign in to comment.