nx/packages/react/plugins/bundle-rollup.ts
Adam L Barrett 889b648886
Emotion upgrade for React and Next plugins (#4088)
* chore(react): update emotion to new versions and new package names on react plugin

* chore(nextjs): update emotion to latest version and the new package names

* feat(misc): have react and next plugin migrations update emotion imports

 * add renamePackageImports and renameNpmPackage rules to workspace utils
 * update migrations to update emotion imports to the new name and version
2020-11-27 13:32:42 -06:00

25 lines
571 B
TypeScript

import * as rollup from 'rollup';
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,
...extraGlobals,
};
}
return options;
}
module.exports = getRollupOptions;