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

flex: 1 1 0 compiled to flex: 1 1 #62002

Closed
benmerckx opened this issue Feb 13, 2024 · 3 comments
Closed

flex: 1 1 0 compiled to flex: 1 1 #62002

benmerckx opened this issue Feb 13, 2024 · 3 comments
Labels
bug Issue was opened via the bug report template. locked

Comments

@benmerckx
Copy link
Contributor

Link to the code that reproduces this issue

https://github.com/benmerckx/next-flex-bug

To Reproduce

Check compiled css

Current vs. Expected behavior

The flex-basis value is omitted. But the browser default of 0% is not the same as the absolute 0 value.

Input css: flex: 1 1 0;
Compiled css: flex: 1 1;
Expected css: flex: 1 1 0;

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: Ubuntu 20.04.0 LTS Tue Feb 13 2024 17:05:09 GMT+0100 (Central European Standard Time)
Binaries:
  Node: 18.18.0
  npm: 10.2.3
  Yarn: 1.22.19
  pnpm: 8.14.0
Relevant Packages:
  next: 14.1.1-canary.51 // Latest available version is detected (14.1.1-canary.51).
  eslint-config-next: 13.5.1
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)

Additional context

No response

@benmerckx benmerckx added the bug Issue was opened via the bug report template. label Feb 13, 2024
@icyJoseph
Copy link
Contributor

icyJoseph commented Feb 13, 2024

Hi,

This is done by the PostCSS plugin, postcss-flexbugs-fixes, and it is called flexbug-4.

There's an already opened issue over there: luisrudge/postcss-flexbugs-fixes#59

Their recommended workaround is to use units, particularly %:

Or you could disable it if you like...

The configuration used by Next.js is roughly:

{
  "plugins": [
    "postcss-flexbugs-fixes",
    [
      "postcss-preset-env",
      {
        "autoprefixer": {
          "flexbox": "no-2009",
          "grid": "autoplace"
        },
        "stage": 3,
        "features": {
          "custom-properties": false
        }
      }
    ]
  ]
}

Taken from:

And there you could disable the bug4 fix with:

In postcss.config.json:

{
  "plugins": [
    ["postcss-flexbugs-fixes", { "bug4" : false }],
    [
      "postcss-preset-env",
      {
        "autoprefixer": {
          "flexbox": "no-2009",
          "grid": "autoplace"
        },
        "stage": 3,
        "features": {
          "custom-properties": false
        }
      }
    ]
  ]
}

You'd need to install postcss-preset-env and postcss-flexbugs-fixes though.

Here it is in action:

Run npx next build and cat .next/static/css/<some-hash-name>.css and you'll see it:

Screenshot 2024-02-13 at 17 46 58

@benmerckx
Copy link
Contributor Author

Thanks for the detailed answer, I guess there's nothing actionable for Next.js here.

Copy link
Contributor

github-actions bot commented Mar 6, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Mar 6, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests

2 participants