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

Failed to Compile Syntax Error - 1.16.2 and Tailwind 3 #329

Closed
MxD-js opened this issue Dec 10, 2021 · 13 comments
Closed

Failed to Compile Syntax Error - 1.16.2 and Tailwind 3 #329

MxD-js opened this issue Dec 10, 2021 · 13 comments
Assignees
Labels

Comments

@MxD-js
Copy link

MxD-js commented Dec 10, 2021

Hey All,

I get this error when I run npm run build

Creating an optimized production build...

🌼 daisyUI components 1.16.2  https://github.com/saadeghi/daisyui
  ✔︎ Including:  base, components, themes[22], utilities
  
Failed to compile.

Syntax error: postcss-custom-properties: <css input> Unknown word (1:1)
> 1 | var(--b1)/var(--tw-bg-opacity,1)
    | ^

I followed this tailwind guide to create a fresh react project,

https://tailwindcss.com/docs/guides/create-react-app

if I remove require("daisyui") from tailwind.config.js then running npm run build, the project builds just fine but breaks when I add daisyui in the plugins section

My package.json

{
  "name": "github-finder",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "daisyui": "^1.16.2",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0-next.58",
    "web-vitals": "^2.1.2"
  },
  "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"
    ]
  },
  "devDependencies": {
    "autoprefixer": "^10.4.0",
    "postcss": "^8.4.4",
    "tailwindcss": "^3.0.0"
  }
}

@zenhorace
Copy link

zenhorace commented Dec 10, 2021

I think this is related to a question I just asked ( #328 ) lol.
Tailwind 3 was just realeased and is the default when you start a new project. I think DaisyUI may need some changes to be compatible

@MxD-js MxD-js changed the title Failed to Compile Syntax Error - 1.16.2 Failed to Compile Syntax Error - 1.16.2 and Tailwind 3 Dec 10, 2021
@saadeghi
Copy link
Owner

@zenhorace @MxD-js Can you please provide an example github repo so I can reproduce this issue?
Because I just created a new project based on the Tailwind guide you mentioned and it works as expected.

@MxD-js
Copy link
Author

MxD-js commented Dec 10, 2021

@zenhorace @MxD-js Can you please provide an example github repo so I can reproduce this issue? Because I just created a new project based on the Tailwind guide you mentioned and it works as expected.

Sure, here's the repo.

https://github.com/MxD-js/my-project-tailwind-daisyui

I cloned your sample project and get the same result, npm run start works fine, but npm run build throws error

worth noting that I am node v16.13.1 and npm 8.1.2

image

@digitaltim-de
Copy link

Same error

@digitaltim-de
Copy link

image

@zenhorace
Copy link

not sure this specifically has anything to do with tailwind 3 or DaisyUI specifically. It seems this issue is related to the postcss-custom-properties. They have an open issue for it. Apparently an issue with the parser and the workaround is to add a space so instead of var(--b1)/var(--tw-bg-opacity,1) we'd have var(--b1) / var(--tw-bg-opacity,1) which should get recognized by the parser. that would mean updating the line in src/base/colors.css

I don't get why it's flaring up just now with tailwind 3 though...

@saadeghi
Copy link
Owner

Can you please upgrade to latest version (1.16.4) and confirm that this fixes the issue?

@MxD-js
Copy link
Author

MxD-js commented Dec 11, 2021

Can you please upgrade to latest version (1.16.4) and confirm that this fixes the issue?

negative, 1.16.4 does not fix it, although I am not noticing the space like mentioned by @zenhorace

image

@saadeghi saadeghi reopened this Dec 11, 2021
@saadeghi saadeghi added the bug label Dec 12, 2021
@saadeghi saadeghi self-assigned this Dec 12, 2021
@digitaltim-de
Copy link

Upgrade to 1.16.4 doesn`t fix it for me too.

image

@saadeghi
Copy link
Owner

Fixed in latest version 1.16.5
Thanks @zenhorace

@zenhorace
Copy link

Thanks for being so prompt with this fix! Ordinarily I'd try to suggest a fix myself but I'm traveling.
Anyhow, you're doing great work with this library and I'll look for opportunities to contribute in the future! 🙂

@MxD-js
Copy link
Author

MxD-js commented Dec 14, 2021

Yep, confirmed working 1.16.5, thanks @saadeghi and @zenhorace

@digitaltim-de
Copy link

Thanks, confirmed works for me too.

inorganik pushed a commit to inorganik/daisyui that referenced this issue Feb 7, 2023
inorganik pushed a commit to inorganik/daisyui that referenced this issue Feb 7, 2023
imgbot bot pushed a commit to Avensen/daisyui that referenced this issue Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants