umijs / dumi

📖 Static Site Generator for component library development
https://d.umijs.org
MIT License
3.6k stars 1.18k forks source link

bug: 开启mako后构建出错:`Module not found: Can't resolve 'dumi/theme/builtins/Container` #2209

Closed zhangfisher closed 1 month ago

zhangfisher commented 1 month ago

Version

2.4.12

OS Version

windows 10

Node.js Version

18

Browser Version

chrome 120

Link to minimal reproduction

https://github.com/zhangfisher/autostore/docs

Steps to reproduce

包管理器 : pnpm

启用mako构建后提示:

 × Module not found: Can't resolve 'dumi/theme/builtins/Container'
   ╭─[..\node_modules\.pnpm\dumi@2.4.12_@babel+core@7.25.2_@swc+helpers@0.5.1_@types+node@20.5.1_@types+react@18.3.7_esli_eww3v6fp2hppnov7eysctl4qoa\node_modules\dumi\dist\client\theme-api\DumiDemo\DemoErrorBoundary.js:1:1]
 1 │ import Container from 'dumi/theme/builtins/Container';

  × Module not found: Can't resolve 'dumi/theme/builtins/Previewer'
   ╭─[..\node_modules\.pnpm\dumi@2.4.12_@babel+core@7.25.2_@swc+helpers@0.5.1_@types+node@20.5.1_@types+react@18.3.7_esli_eww3v6fp2hppnov7eysctl4qoa\node_modules\dumi\dist\client\theme-api\DumiDemo\index.js:2:1]
 2 │ import { SP_ROUTE_PREFIX } from "../../../constants";
 3 │ import { useAppData, useDemo, useSiteData } from 'dumi';
 4 │ import React, { createElement } from 'react';
 5 │ import Previewer from 'dumi/theme/builtins/Previewer';
   ·                       ───────────────────────────────
 6 │ import { useRenderer } from "../useRenderer";
 7 │ import DemoErrorBoundary from "./DemoErrorBoundary";
 8 │ var InternalDumiDemo = function InternalDumiDemo(props) {
   ╰────

  × Module not found: Can't resolve 'dumi/theme/slots/ContentTabs'
    ╭─[..\node_modules\.pnpm\dumi@2.4.12_@babel+core@7.25.2_@swc+helpers@0.5.1_@types+node@20.5.1_@types+react@18.3.7_esli_eww3v6fp2hppnov7eysctl4qoa\node_modules\dumi\dist\client\theme-api\DumiPage.js:5:1]
  5 │ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; 
} finally { if (_d) throw _e; } } return _arr; } }
  6 │ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  7 │ import { useRouteMeta } from 'dumi';
  8 │ import ContentTabs from 'dumi/theme/slots/ContentTabs';
    ·                         ──────────────────────────────
  9 │ import React, { useState } from 'react';
 10 │ import { useTabQueryState } from "./useTabMeta";
 11 │ export var DumiPage = function DumiPage(props) {
    ╰────

所有dumi/theme/xxxx均无法发现模块

What is expected?

成功构建

What is actually happening?

成功构建

Any additional comments? (optional)

No response

Jinbao1001 commented 1 month ago

复现仓库无法访问.

zhangfisher commented 1 month ago

https://github.com/zhangfisher/autostore/tree/master/docs

Jinbao1001 commented 1 month ago

测试 pnpm@8pnpm@9 未复现上述问题.

不过有其他报错信息 moduleId 越界, 节后排查下.

Jinbao1001 commented 1 month ago

怀疑是 chunkIdUrlMap 导致的问题, 已修复, 等mako下个版本发版再验证下.

目前可以在 mako.config.json中配置绕过.

 {"moduleIdStrategy": "hashed"} 
zhangfisher commented 1 month ago

好象绕不过,我公司的家里电脑均出现同样的问题 image

Jinbao1001 commented 1 month ago

那可能是windows系统兼容的原因了, 等我整个虚拟机...