cssinjs icon indicating copy to clipboard operation
cssinjs copied to clipboard

NextJS 14 SSR whole export issue with cssinjs

Open endless9567 opened this issue 11 months ago • 2 comments

Reproduce link:

https://codesandbox.io/p/devbox/6tngmj

I am now facing an issue with cssinjs while turbopack is enabled. It is fine while turbopack is disabled. And css file can be extracted successfully,

Image

Image

But When I enable turpopack and restart the project, the file output path is not correct. And that css file is empty. Css styles are not extracted at all.

Image

Below is my package.json configuration:

{
  "name": "create-next-app-antd",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --port 8080",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "devDependencies": {
    "@ant-design/cssinjs": "1.23.0",
    "@ant-design/static-style-extract": "1.0.3",
    "@reduxjs/toolkit": "2.5.0",
    "@tanstack/react-query": "5.64.1",
    "@types/node": "22.13.5",
    "@types/react": "18.3.18",
    "@types/react-dom": "18.3.5",
    "@types/react-redux": "7.1.34",
    "antd": "5.23.1",
    "eslint": "9.21.0",
    "eslint-config-next": "15.2.0",
    "next": "14.2.24",
    "react": "18.3.1",
    "react-dom": "18.3.1",
    "react-redux": "9.2.0",
    "ts-node": "10.9.2",
    "tslib": "2.8.1",
    "typescript": "5.7.3"
  }
}

I see NextJS documentation mentioned that the behavior of __dirname is sometimes different from normal situations.

Image

Anyway, could someone check this issue and provide some help, thanks a lot

endless9567 avatar Mar 19 '25 04:03 endless9567

Is it a turbo issue or antd cssinjs issue?

afc163 avatar Mar 19 '25 05:03 afc163

Is it a turbo issue or antd cssinjs issue?

I am not sure. If turbopack is disabled it works fine.

endless9567 avatar Mar 19 '25 05:03 endless9567

while Turbopack is disabled, everything is working fine

endless9567 avatar Apr 30 '25 09:04 endless9567