semi-design icon indicating copy to clipboard operation
semi-design copied to clipboard

[BUG] ESM support for @semi/next

Open shanliangc opened this issue 10 months ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Which Component

nextjs config

Semi Version

2.56.3

Current Behavior

Hi, I am trying semi-ui with nextjs framework NextConfig code is like:

/** @type {import('next').NextConfig} */

import SemiNextConfig from "@douyinfe/semi-next";

const semi = SemiNextConfig({
  omitCss: true,
});

const nextConfig = {
  transpilePackages: [
    "@douyinfe/semi-ui",
    "@douyinfe/semi-icons",
    "@douyinfe/semi-illustrations",
  ],
};

export default semi(nextConfig);
// export default nextConfig;

while it compiles fail.

file:///Users/shanliangchen/Development/frontend/max-airdrop/next.config.mjs:5
const semi = SemiNextConfig({
             ^

TypeError: SemiNextConfig is not a function
    at file:///Users/shanliangchen/Development/frontend/max-airdrop/next.config.mjs:5:14
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async loadConfig (/Users/shanliangchen/Development/frontend/max-airdrop/node_modules/next/dist/server/config.js:698:36)
    at async Module.nextDev (/Users/shanliangchen/Development/frontend/max-airdrop/node_modules/next/dist/cli/next-dev.js:175:14)

Node.js v20.11.0
(base) 

with info TypeError: SemiNextConfig is not a function. I am sure that SemiNextConfig is indeed a function.

How can I fix that? Thanks for your help

Expected Behavior

Just works normally with custom theme.

Steps To Reproduce

No response

ReproducibleCode

No response

Environment

- "@douyinfe/semi-next": "^2.56.3",
- "@douyinfe/semi-ui": "^2.56.3",
- "next": 14

Anything else?

No response

shanliangc avatar Apr 22 '24 10:04 shanliangc