ant-design-mobile icon indicating copy to clipboard operation
ant-design-mobile copied to clipboard

Module parse failed: Cannot use 'import.meta' outside a module

Open jackple opened this issue 6 months ago • 6 comments

Version of antd-mobile

5.33.2

Operating system and its version

Others

Browser and its version

every

Sandbox to reproduce

No response

What happened?

按照官方的配置https://mobile.ant.design/zh/guide/ssr#nextjs-13 直接在项目中使用

import { Button } from 'antd-mobile'

<Button>aaaaa</Button>

报错:

▲ Next.js 13.5.6

  • Local: http://localhost:3000
  • Environments: .env

✓ Ready in 3.3s ⨯ ./node_modules/antd-mobile/node_modules/classnames/index.js Module parse failed: Cannot use 'import.meta' outside a module (93:16) | // still a Refresh Boundary later. | // @ts-ignore importMeta is replaced in the loader

            import.meta.webpackHot.accept();

| // This field is set when the previous version of this module was a | // Refresh Boundary, letting us know we need to check for invalidation or

Import trace for requested module: ./node_modules/antd-mobile/node_modules/classnames/index.js ./node_modules/antd-mobile/es/components/action-sheet/action-sheet.js ./node_modules/antd-mobile/es/components/action-sheet/index.js ./node_modules/antd-mobile/es/index.js ○ Compiling / ... ⨯ ./node_modules/antd-mobile/node_modules/classnames/index.js Module parse failed: Cannot use 'import.meta' outside a module (93:16) | // still a Refresh Boundary later. | // @ts-ignore importMeta is replaced in the loader

            import.meta.webpackHot.accept();

| // This field is set when the previous version of this module was a | // Refresh Boundary, letting us know we need to check for invalidation or

Import trace for requested module: ./node_modules/antd-mobile/node_modules/classnames/index.js ./node_modules/antd-mobile/es/components/action-sheet/action-sheet.js ./node_modules/antd-mobile/es/components/action-sheet/index.js ./node_modules/antd-mobile/es/index.js

Relevant log output

No response

jackple avatar Dec 29 '23 08:12 jackple