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

feat(nextjs): add composePlugins util when using multiple plugins #16296

Merged
merged 1 commit into from
Apr 13, 2023

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Apr 13, 2023

This PR adds a composePlugins function to @nrwl/next, which makes it easier when using multiple Next.js plugins together with Nx.

// next.config.js

const plugins = [
  // Add as many plugins here
  withMDX,
  withNx
  // ...
];

// The composed function will know how to handle normal plugins and plugins that return an async function (e.g. `withNx`).
module.exports = composePlugins(...plugins)({
  // normal next.js config
});

Also generates apps with plugins array and composePlugins function so it's obvious to users how they can add more plugins.


Closes #16278

@vercel
Copy link

vercel bot commented Apr 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Apr 13, 2023 9:02pm

@ndcunningham ndcunningham merged commit 7322751 into nrwl:master Apr 13, 2023
@jaysoo jaysoo deleted the feat/nextjs-compose-plugins branch April 13, 2023 21:42
@burakkgunduzz
Copy link

Great addition @jaysoo thanks. What is the proper way to add smt like with sentry that also accepts second arg like sentryWebpackPluginOptions?

@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

withNx changes broke compatibility with other NextJS plugins
3 participants