Skip to content

Commit

Permalink
fix(preset-umi): resolve the path of react-helmet-async within render
Browse files Browse the repository at this point in the history
  • Loading branch information
SK-Luffa committed Jul 11, 2024
1 parent e8d057f commit e1be908
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/preset-umi/src/features/vite/vite.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { winPath } from '@umijs/utils';
import path from 'path';
import type { IApi } from '../../types';
import { isWindows } from '../../utils/platform';

import { winPath } from '@umijs/utils';
import { dirname } from 'path';
import { resolveProjectDep } from '../../utils/resolveProjectDep';

// 解析react-helmet-async 在renderer-react中的路径
// 解析 react-helmet-async 在 renderer-react 中的路径
const { dirname } = path;
let corePath: string | undefined;
const REACT_HELMET_ASYNC = 'react-helmet-async';
const RENDERER_REACT = '@umijs/renderer-react';
Expand All @@ -19,11 +18,8 @@ const getReactHelmetAsyncPath = (api: IApi) => {
);
// 解析 renderer-react 包的路径
try {
const rendererReactPath = resolveProjectDep({
pkg: api.pkg,
cwd: api.cwd,
dep: RENDERER_REACT,
});
const rendererReactPath = require.resolve(RENDERER_REACT);

pkgPath = rendererReactPath ? winPath(rendererReactPath) : defaultPkgPath;
} catch (e: any) {
throw new Error(
Expand Down

0 comments on commit e1be908

Please sign in to comment.