facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.74k stars 26.86k forks source link

TypeError: lilconfigSync is not a function #13087

Open ucefkh opened 1 year ago

ucefkh commented 1 year ago

Welcome to this lil bug,

if you typed 'TypeError: lilconfigSync is not a function' on google you came here because this is the only result.

πŸ› πŸ›πŸ›πŸ›πŸ›Describe the bugπŸ›πŸ›πŸ›πŸ›πŸ›

So there is a bug when running the v5.0.1 and it is totally not clear why but something related to babel and CSS

image

$ npm run build

> app-dashboard@0.1.0 build
> react-scripts build

Creating an optimized production build...
Failed to compile.

static/css/main.eb35693f.css from Css Minimizer plugin
TypeError: lilconfigSync is not a function

package.json

{
  "name": "app-dashboard",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@mui/icons-material": "^5.11.11",
    "@mui/material": "^5.11.14",
    "@mui/styles": "^5.11.13",
    "@otplib/preset-browser": "^12.0.1",
    "@stripe/react-stripe-js": "^2.1.0",
    "@stripe/stripe-js": "^1.52.0",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^14.0.0",
    "@testing-library/user-event": "^14.4.3",
    "ejs": "^3.1.9",
    "firebase": "^9.18.0",
    "firebaseui": "^6.0.2",
    "ra-input-rich-text": "^4.9.0",
    "react": "^18.2.0",
    "react-admin": "^4.9.0",
    "react-admin-firebase": "^4.1.1",
    "react-dom": "^18.2.0",
    "react-scripts": "^5.0.1",
    "web-vitals": "^3.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
antonk52 commented 1 year ago

Hi, lilconfig maintainer here.

I could not replicate the issue locally. Steps that I took:

  1. I took package.json you provided
  2. copy-pasted src and public directories from a fresh create-react-app boilerplate
  3. yarn to install dependencies
  4. yarn run build to build the project

The project builds as expected.

From the yarn.lock file I can see that lilconfig is a dependency of cssnano, postcss-load-config, and tailwind. Those are expected. These dependencies are not bundled with your source code so should not be be causing the issue you are reporting.

Can you provide a minimal reproduction steps to get the same build error? Maybe use codesandbox? This way people who want to help you could see if there is something causing the error in the source code. I think the easiest way would be to start with a fresh CRA template and see which change causes the error.

Thanks