Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix: remove postcss.config from schema #9181

Merged
merged 3 commits into from
Nov 19, 2022

Conversation

nathanchase
Copy link
Contributor

@nathanchase nathanchase commented Nov 19, 2022

πŸ”— Linked issue

resolves nuxt/nuxt#14121

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codesandbox
Copy link

codesandbox bot commented Nov 19, 2022

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@nathanchase
Copy link
Contributor Author

nathanchase commented Nov 19, 2022

I brought up the reason for this PR on the Nuxt Discord: https://discord.com/channels/473401852243869706/1043174741135069184

Essentially, the docs seemed to indicate that this was a boolean, even though it seems like it should have been a string (path to a postcss.config.js). nuxt/nuxt#14121 seems to indicate this would be a moot point anyway if it is to be deprecated.

Perhaps we can have a postcss.config.js be auto-imported if one exists in the root?

@nathanchase nathanchase changed the title docs: Remove postcss.config from schema (for issue 5368) fix: Remove postcss.config from schema (for issue 5368) Nov 19, 2022
Copy link
Member

danielroe commented Nov 19, 2022

We don't want to support an external postcss.config.js as other modules may well depend on the user-set values and need to be able to read/set them from the nuxt config file.

@nathanchase
Copy link
Contributor Author

We don't want to support an external postcss.config.js as other modules may well depend on the user-set values and need to be able to read/set them from the nuxt config file.

Understood. That makes sense in context of Nuxt modules. We may want to be explicit in the Nuxt docs somewhere then that Nuxt can only configure postcss via the nuxt.config - since postcss's docs explicitly say to include a postcss.config as the recommended method of configuring it.

@pi0
Copy link
Member

pi0 commented Nov 19, 2022

Thanks for your pull request @nathanchase ❀️ Webpack and Schema were left over i forgot to finally include in 3.0.0.

since postcss's docs explicitly say to include a postcss.config as the recommended method of configuring it.

Indeed it is a tricky situation when comes to external config files. Technically it is not a limitation. We can load postcss config and merge it with Nuxt config and also allow modules extend the merged result but more a consistency aspect since we don't also load external vite.config, nitro.config, babel.config etc. Again tricky because some modules (like tailwind) actually do support external configs! PS: They have usually more than one file to configure. We can try to mimic config loading but it is not precise and can be conflicting with another project in same root dir.

We may want to be explicit in the Nuxt docs somewhere then that Nuxt can only configure postcss via the nuxt.config

Seems good idea. We can clarify it with JSDocs for configuration that we don't load it. But if you have an idea of somewhere more accessible that we talk about generic Nuxt and External config files that would be awesome πŸ‘πŸΌ

@pi0 pi0 changed the title fix: Remove postcss.config from schema (for issue 5368) fix: remove postcss.config from schema Nov 19, 2022
@pi0 pi0 merged commit 13e4f8b into nuxt:main Nov 19, 2022
@nathanchase
Copy link
Contributor Author

Thanks for your pull request @nathanchase ❀️ Webpack and Schema were left over i forgot to finally include in 3.0.0.

since postcss's docs explicitly say to include a postcss.config as the recommended method of configuring it.

Indeed it is a tricky situation when comes to external config files. Technically it is not a limitation. We can load postcss config and merge it with Nuxt config and also allow modules extend the merged result but more a consistency aspect since we don't also load external vite.config, nitro.config, babel.config etc. Again tricky because some modules (like tailwind) actually do support external configs! PS: They have usually more than one file to configure. We can try to mimic config loading but it is not precise and can be conflicting with another project in same root dir.

We may want to be explicit in the Nuxt docs somewhere then that Nuxt can only configure postcss via the nuxt.config

Seems good idea. We can clarify it with JSDocs for configuration that we don't load it. But if you have an idea of somewhere more accessible that we talk about generic Nuxt and External config files that would be awesome πŸ‘πŸΌ

I'd say https://nuxt.com/docs/getting-started/configuration seems like a good candidate for where to describe how Nuxt does or doesn't support external config files. I'd say for sure to include the ones you mentioned - vite.config, nitro.config, babel.config, postcss.config. and how they are configured in Nuxt via nuxt.config instead.

As you said, it is confusing since there are configuration files like .eslintrc.js or tsconfig.json or .editorconfig that do work for the respective use cases and are generally necessary external config files.

I'll work on another PR and try to come up with a list of common config files that you might have in a Nuxt 3 project, and perhaps we can just create a side-by-side table saying how those configurations are integrated with Nuxt.

@nathanchase
Copy link
Contributor Author

PR added: #9189

@HigherOrderLogic
Copy link
Contributor

Isn't this a breaking change?

Copy link
Member

Yes, this is a breaking change. And technically vite still has the ability to use an external postcss.config file unless we explicitly disable it (which we are not doing, but could)...

@pi0 shall we instead deprecate this config and then remove it entirely in 3.1?

@pi0 pi0 mentioned this pull request Dec 15, 2022
6 tasks
@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe mentioned this pull request Jan 20, 2023
danielroe pushed a commit that referenced this pull request Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate external postcss.config for webpack
4 participants