ant-design / ant-design-mobile

Essential UI blocks for building mobile web apps.
https://mobile.ant.design
MIT License
11.5k stars 2.37k forks source link

引入antd mobile报这个错误 #6563

Closed lihong1232 closed 1 month ago

lihong1232 commented 4 months ago

Version of antd-mobile

5.34.0

Operating system and its version

Others

Browser and its version

Version 122.0.6261.95 (Official Build) (64-bit)

Sandbox to reproduce

No response

What happened?

Collecting page data ...C:\work\wallet\wallet\node_modules\antd-mobile\cjs\global\global.css:1 :root { ^

SyntaxError: Unexpected token ':' at internalCompileFunction (node:internal/vm:73:18) at wrapSafe (node:internal/modules/cjs/loader:1178:20) at Module._compile (node:internal/modules/cjs/loader:1220:27) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Module.require (node:internal/modules/cjs/loader:1143:19) at mod.require (C:\work\wallet\wallet\node_modules\next\dist\server\require-hook.js:65:28) at require (node:internal/modules/cjs/helpers:119:18) at Object. (C:\work\wallet\wallet\node_modules\antd-mobile\cjs\global\index.js:3:1)

Build error occurred Error: Failed to collect page data for /home at C:\work\wallet\wallet\node_modules\next\dist\build\utils.js:1258:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { type: 'Error' }

Relevant log output

No response

IronKinoko commented 4 months ago

看起来是在next.js环境里引入的,先看下这个文档尝试解决 https://mobile.ant.design/zh/guide/ssr