Yrobot / i18next-ssg

The package for i18n next.js project SSG (static site generate) (html build)
https://codesandbox.io/p/github/yrobot-demo/i18next-ssg/master
MIT License
34 stars 3 forks source link

你的示例工程在我的环境下无法通过编译不明白是什么问题 #11

Open AKAMKII6666 opened 11 months ago

AKAMKII6666 commented 11 months ago

手下那这是个非常不错的组件,于是我决定着手将它搬进我的项目里,但是我按照你的文档把它搬进去以后,出现了TypeError: Cannot read properties of undefined (reading '_isAppDir'),所以我就尝试用你的示例工程看看是不是有什么组件的版本有区别,结果发现你的示例工程也会出现这个问题:

yarn build

yarn run v1.22.18 warning package.json: No license field $ next build && next export -o out

./node_modules/i18next-ssg/dist/esm/config.js Critical dependency: the request of a dependency is an expression

Import trace for requested module: ./node_modules/i18next-ssg/dist/esm/config.js ./node_modules/i18next-ssg/dist/esm/index.js

Build error occurred TypeError: Cannot read properties of undefined (reading '_isAppDir') at F:\workspace\persionalGitLib\i18next-ssg-master\node_modules\next\dist\export\index.js:411:39 at Array.filter () at F:\workspace\persionalGitLib\i18next-ssg-master\node_modules\next\dist\export\index.js:410:43 at async Span.traceAsyncFn (F:\workspace\persionalGitLib\i18next-ssg-master\node_modules\next\dist\trace\trace.js:103:20) at async F:\workspace\persionalGitLib\i18next-ssg-master\node_modules\next\dist\build\index.js:1511:21 at async Span.traceAsyncFn (F:\workspace\persionalGitLib\i18next-ssg-master\node_modules\next\dist\trace\trace.js:103:20) at async F:\workspace\persionalGitLib\i18next-ssg-master\node_modules\next\dist\build\index.js:1367:17 at async Span.traceAsyncFn (F:\workspace\persionalGitLib\i18next-ssg-master\node_modules\next\dist\trace\trace.js:103:20) at async build (F:\workspace\persionalGitLib\i18next-ssg-master\node_modules\next\dist\build\index.js:145:29) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

重点是这一句 TypeError: Cannot read properties of undefined (reading '_isAppDir')

系统:windows10 nodejs: V18.16.1

AKAMKII6666 commented 11 months ago

刚刚又去测试了一下,发现MAC可以编译,有没有可能支持windows编译或者可能是我的windows环境有问题?

Yrobot commented 11 months ago

可能是windows的文件路径逻辑和linux不一样导致的 isApp的判断报错了,待修复。欢迎PR