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(bundling): extract rollup plugins into withNx function for use with run-commands #26168

Merged
merged 1 commit into from
May 31, 2024

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented May 28, 2024

This PR adds withNx function to @nx/rollup/with-nx so it can be used in rollup.config.js to replicate what @nx/rollup:rollup executor does without needing to use the executor.

e.g.

// rollup.config.js
const { withNx } = require("@nx/rollup/with-nx");

module.exports = withNx(
  {
    main: "./src/index.ts",
    outputPath: "./dist",
    tsConfig: "./tsconfig.lib.json",
    compiler: "babel",
    external: ["react", "react-dom", "react/jsx-runtime"],
    format: ["esm"],
    assets: [{ input: ".", output: ".", glob: "README.md" }],
  },
  {
    // Provide additional rollup configuration here. See: https://rollupjs.org/configuration-options
    // e.g.
    // output: { sourcemap: true },
  }
);

Notes

  1. Existing @nx/rollup:rollup continues to encapsulate rollup options and will not support an isolated mode.
  2. Newly created JS and React libs with --bundler=rollup will use the new withNx function and explicit rollup.config.js.
  3. If NX_ADD_PLUGINS=false or useInferencePlugins: false is set, then new projects will continue to use the @nx/rollup:rollup executor.

Copy link

vercel bot commented May 28, 2024

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

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview May 31, 2024 1:40pm

@jaysoo jaysoo force-pushed the feat/rollup-plugin branch 11 times, most recently from 27b43cb to 0ecdbc2 Compare May 29, 2024 01:15
@jaysoo jaysoo marked this pull request as ready for review May 29, 2024 02:03
@jaysoo jaysoo requested review from a team as code owners May 29, 2024 02:03
@jaysoo jaysoo requested review from meeroslav and mandarini May 29, 2024 02:03
@jaysoo jaysoo force-pushed the feat/rollup-plugin branch from 0ecdbc2 to 67c4994 Compare May 29, 2024 02:17
@jaysoo jaysoo requested a review from a team as a code owner May 29, 2024 02:17
@jaysoo jaysoo force-pushed the feat/rollup-plugin branch 10 times, most recently from ab04d3d to ce7cc81 Compare May 29, 2024 14:51
@jaysoo jaysoo force-pushed the feat/rollup-plugin branch from ce7cc81 to 58cca88 Compare May 30, 2024 16:37
@jaysoo jaysoo force-pushed the feat/rollup-plugin branch 2 times, most recently from b5f05a7 to 31dd2b1 Compare May 30, 2024 20:02
@jaysoo jaysoo force-pushed the feat/rollup-plugin branch 2 times, most recently from 4448d60 to 84e1a88 Compare May 31, 2024 13:28
@jaysoo jaysoo force-pushed the feat/rollup-plugin branch from 84e1a88 to b4e7ea3 Compare May 31, 2024 13:38
@jaysoo jaysoo merged commit 4e49d52 into master May 31, 2024
6 checks passed
@jaysoo jaysoo deleted the feat/rollup-plugin branch May 31, 2024 14:50
Copy link

github-actions bot commented Jun 7, 2024

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 Jun 7, 2024
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.

3 participants