Skip to content

Commit

Permalink
fix: wrong doctor result for pre-bundle files
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Dec 7, 2022
1 parent f3cd84e commit 7dbab90
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/doctor/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export default async (

// omit non-js files(such as svg), to avoid throw error
builder.onLoad(
{ filter: /.(svg|png|jpg|jpeg|gif|woff|woff2|ttf|eot|mp3|mp4)$/ },
{
filter: /.(svg|png|jpg|jpeg|gif|woff|woff2|ttf|eot|mp3|mp4|tpl)$/,
},
() => {
return { contents: '', loader: 'text' };
},
Expand Down
9 changes: 7 additions & 2 deletions src/doctor/rules/PACK_FILES_MISSING.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { winPath } from '@umijs/utils';
import path from 'path';
import type { IDoctorReport } from '..';
import type { IApi } from '../../types';
Expand All @@ -14,10 +15,14 @@ export default (api: IApi) => {
bundleConfigs.forEach((c) => entities.push(c.output.path));
bundlessConfigs.forEach((c) => entities.push(c.output));
Object.values(preBundleConfig.deps).forEach((c) =>
entities.push(path.basename(c.output)),
entities.push(
winPath(path.relative(api.cwd, path.dirname(c.output))),
),
);
Object.values(preBundleConfig.dts).forEach((c) =>
entities.push(path.basename(c.output)),
entities.push(
winPath(path.relative(api.cwd, path.basename(c.output))),
),
);

// TODO: main/module entities
Expand Down
4 changes: 3 additions & 1 deletion src/doctor/rules/PHANTOM_DEPS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export default (api: IApi) => {
const errors: IDoctorReport = [];

imports.forEach((i) => {
const pkgName = i.path.match(/^(?:@[\w-][\w-.]*\/)?[\w-][\w-.]*/i)?.[0];
const pkgName = i.path.match(
/^(?:@[a-z\d][\w-.]*\/)?[a-z\d][\w-.]*/i,
)?.[0];
const aliasKeys = Object.keys(mergedAlias);

if (
Expand Down

0 comments on commit 7dbab90

Please sign in to comment.