Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: missing DEFAULT_DURATION when compile ant component #1424

Closed
erguotou520 opened this issue Jun 24, 2024 · 1 comment · Fixed by #1416
Closed

[Bug Report]: missing DEFAULT_DURATION when compile ant component #1424

erguotou520 opened this issue Jun 24, 2024 · 1 comment · Fixed by #1416
Labels
bug Something isn't working
Milestone

Comments

@erguotou520
Copy link

erguotou520 commented Jun 24, 2024

Thanks for the great project. It's so fast and ready to replace our current projects except the following issue.

Steps to reproduce

Steps to reproduce:

bun create farm@latest farm-test
bun i antd
# update `main.tsx` with the following content
bun run build
import './main.css'
import zhCN from 'antd/locale/zh_CN'
import { ConfigProvider, message } from 'antd'
import { useEffect } from 'react'
export function Main() {
  useEffect(() => {
    message.info('Hello, Ant Design!')
  }, [])

  return (
    <ConfigProvider
      locale={zhCN}
      theme={{
        cssVar: true,
        hashed: false,
        token: {
          colorPrimary: '#8473FF',
          colorLink: '#8473FF',
          colorInfo: '#8473FF',
          borderRadius: 2,
        },
        components: {
          Menu: {
            darkItemBg: 'transparent',
            darkItemColor: 'black',
            darkItemHoverBg: '#8473FF',
            itemBorderRadius: 4,
            itemPaddingInline: 30,
          },
          Button: {
            borderRadius: 4,
          },
        },
      }}
    >
      <div>123</div>
    </ConfigProvider>
  )
}

Reproduce link

https://github.com/erguotou520/farm-ant-issue

What is actually happening?

After build, run npx farm preview, the error shows in the console

Uncaught ReferenceError: DEFAULT_DURATION is not defined

The reproduce repo just use the message.info function which cause the error. The error DEFAULT_DURATION refers to the code https://github.com/ant-design/ant-design/blob/master/components/message/useMessage.tsx#L64

System Info

System:
    OS: macOS 12.5
    CPU: (8) arm64 Apple M1
    Memory: 108.52 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
    Yarn: 1.22.22 - ~/.yarn/bin/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.0/bin/npm
    pnpm: 8.5.1 - ~/Library/pnpm/pnpm
    bun: 1.1.12 - ~/.bun/bin/bun
  npmPackages:
    @farmfe/core: ^1.1.13 => 1.2.0
@shulandmimi
Copy link
Member

because of treeShaking, you can disable it by setting complation.treeShaking to false in farm.config.ts. we will notify you when we fix it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants