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.
```js
// 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.