This PR removes these from v20 since they were deprecated and slated for removal: - `executeWebpackDevServerBuilder` export from `@nx/angular/executors`, users should use `executeDevServerBuilder` - `withStylus` util from `@nx/next/plugins/with-stylus` since it was deprecated in v17 and has just throw an error that users need to use SASS with Next.js The `getRollupOptions` function from `@nx/react/plugins/bundle-rollup` has been deprecated as mention previously and slated for removal in v22. New users are using inferred targets from Rollup, and existing projects using this module should run `nx g @nx/rollup:convert-to-inferred` or manually update rollup config to use `withNx` function. Also, bumped some deprecation for later in v21: - Remove inline builds from tsc/swc - Changes to SVGR to align with Webpack v5 (e.g. `import ReactComponent from './img.svg?svgr'`) - Remove `isolatedConfig` from Webpack executor -- requires a migration that extracts to a standard webpack config just in case (different from the original one that extracts to `withNx`) The ESLint TODOs were rescoped to `TODO(eslint)` and we'll look at it in further flat config work rather than tying it to an Nx release. <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import * as rollup from 'rollup';
|
|
|
|
// TODO(v22): Remove this in Nx 22 and migrate to explicit rollup.config.js files.
|
|
/**
|
|
* @deprecated Use `withNx` function from `@nx/rollup/with-nx` in your rollup.config.js file instead. Use `nx g @nx/rollup:convert-to-inferred` to generate the rollup.config.js file if it does not exist.
|
|
*/
|
|
function getRollupOptions(options: rollup.RollupOptions) {
|
|
const extraGlobals = {
|
|
react: 'React',
|
|
'react-dom': 'ReactDOM',
|
|
'styled-components': 'styled',
|
|
'@emotion/react': 'emotionReact',
|
|
'@emotion/styled': 'emotionStyled',
|
|
};
|
|
|
|
if (Array.isArray(options.output)) {
|
|
options.output.forEach((o) => {
|
|
o.globals = { ...o.globals, ...extraGlobals };
|
|
});
|
|
} else {
|
|
options.output = {
|
|
...options.output,
|
|
globals: {
|
|
...options.output.globals,
|
|
...extraGlobals,
|
|
},
|
|
};
|
|
}
|
|
|
|
// React buildable libs support SVGR, but not for React Native.
|
|
// If imports fail, ignore it.
|
|
try {
|
|
const url = require('@rollup/plugin-url');
|
|
const svg = require('@svgr/rollup');
|
|
|
|
options.plugins = [
|
|
svg({
|
|
svgo: false,
|
|
titleProp: true,
|
|
ref: true,
|
|
}),
|
|
url({
|
|
limit: 10000, // 10kB
|
|
}),
|
|
...(Array.isArray(options.plugins) ? options.plugins : []),
|
|
];
|
|
} catch {
|
|
// Ignored for React Native
|
|
}
|
|
|
|
return options;
|
|
}
|
|
|
|
module.exports = getRollupOptions;
|