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

Next.js does not like when plugins add fields to the config object #22

Open
wereHamster opened this issue Nov 6, 2023 · 0 comments
Open

Comments

@wereHamster
Copy link

wereHamster commented Nov 6, 2023

export default withLinaria({
  cacheDirectory: "./.next/cache/linaria",

  experimental: {
    externalDir: true,
  },
})
 ⚠ Invalid next.config.js options detected:
 ⚠     Unrecognized key(s) in object: 'cacheDirectory'
 ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config

Better is to separate the plugin-specific config from the Next.js config, like so:

export default withLinaria({ cacheDirectory: "./.next/cache/linaria" })({
  experimental: {
    externalDir: true,
  },
})

That also makes it possible to combine multiple plugins with the help of next-compose-plugins:

import withPlugins from "next-compose-plugins";

export default withPlugins([
  withLinaria({ cacheDirectory: "./.next/cache/linaria" }),
  withMdx(),
  withNx(),
], {
  experimental: {
    externalDir: true,
  },
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant