Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 识别 libs/xxx 为本地内部依赖 #10594

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/mfsu/src/babelPlugins/awaitImport/checkMatch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Babel from '@umijs/bundler-utils/compiled/babel/core';
import { isLocalDev, winPath, aliasUtils } from '@umijs/utils';
import { aliasUtils, isLocalDev, winPath } from '@umijs/utils';
import assert from 'assert';
import { isAbsolute, join } from 'path';
import type { IOpts } from './awaitImport';
Expand All @@ -10,9 +10,15 @@ const RE_NODE_MODULES = /node_modules/;

function isUmiLocalDev(path: string) {
const rootPath = isLocalDev();
return rootPath
? winPath(path).startsWith(winPath(join(rootPath, './packages')))
: false;
if (rootPath) {
const winP = winPath(path);
const pkgP = winPath(join(rootPath, './packages'));
const libP = winPath(join(rootPath, './libs'));

return winP.startsWith(pkgP) || winP.startsWith(libP);
} else {
return false;
}
}

function genUnMatchLibsRegex(libs?: Array<string | RegExp>) {
Expand Down
1 change: 0 additions & 1 deletion ui/.umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ export default {
reactQuery: {},
valtio: {},
icons: {},
mfsu: false,
};