Skip to content

Commit

Permalink
feat(bundling): upgrade rollup to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Apr 3, 2024
1 parent 7f00927 commit cd3088f
Show file tree
Hide file tree
Showing 7 changed files with 693 additions and 1,066 deletions.
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@
"@reduxjs/toolkit": "1.9.0",
"@remix-run/dev": "^2.8.1",
"@remix-run/node": "^2.8.1",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-image": "^2.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-url": "^7.0.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-url": "^8.0.2",
"@schematics/angular": "~17.3.0",
"@side/jest-runtime": "^1.1.0",
"@storybook/addon-essentials": "7.5.3",
Expand All @@ -102,7 +102,7 @@
"@storybook/react-webpack5": "7.5.3",
"@storybook/types": "^7.1.1",
"@supabase/supabase-js": "^2.26.0",
"@svgr/rollup": "^8.0.1",
"@svgr/rollup": "^8.1.0",
"@svgr/webpack": "^8.0.1",
"@swc-node/register": "1.8.0",
"@swc/cli": "0.1.62",
Expand Down Expand Up @@ -255,11 +255,10 @@
"react-textarea-autosize": "^8.5.3",
"regenerator-runtime": "0.13.7",
"resolve.exports": "1.1.0",
"rollup": "^2.56.2",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-typescript2": "0.36.0",
"rollup": "^4.14.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-typescript2": "^0.36.0",
"rxjs": "^7.8.0",
"sass": "1.55.0",
"sass-loader": "^12.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/plugins/bundle-rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function getRollupOptions(options: rollup.RollupOptions) {
url({
limit: 10000, // 10kB
}),
...options.plugins,
...(Array.isArray(options.plugins) ? options.plugins : []),
];
} catch {
// Ignored for React Native
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/utils/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export const lessVersion = '3.12.2';
export const sassVersion = '^1.55.0';

// rollup plugins (if needed)
export const rollupPluginUrlVersion = '^7.0.0';
export const svgrRollupVersion = '^8.0.1';
export const rollupPluginUrlVersion = '^8.0.2';
export const svgrRollupVersion = '^8.1.0';

export const swcPluginStyledJsxVersion = '^1.5.67';
export const swcPluginEmotionVersion = '^2.5.67';
Expand Down
19 changes: 9 additions & 10 deletions packages/rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,19 @@
"migrations": "./migrations.json"
},
"dependencies": {
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-image": "^2.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"autoprefixer": "^10.4.9",
"babel-plugin-transform-async-to-promises": "^0.8.15",
"chalk": "^4.1.0",
"postcss": "^8.4.14",
"rollup": "^2.56.2",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-typescript2": "0.36.0",
"rollup": "^4.14.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-typescript2": "^0.36.0",
"tslib": "^2.3.0",
"@nx/devkit": "file:../devkit",
"@nx/js": "file:../js"
Expand Down
10 changes: 4 additions & 6 deletions packages/rollup/src/executors/rollup/rollup.impl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as ts from 'typescript';
import * as rollup from 'rollup';
import * as peerDepsExternal from 'rollup-plugin-peer-deps-external';
import { getBabelInputPlugin } from '@rollup/plugin-babel';
import { dirname, join, parse, resolve } from 'path';
import * as autoprefixer from 'autoprefixer';
Expand Down Expand Up @@ -152,7 +151,6 @@ export async function createRollupOptions(
npmDeps: string[]
): Promise<rollup.RollupOptions> {
const useBabel = options.compiler === 'babel';
const useTsc = options.compiler === 'tsc';
const useSwc = options.compiler === 'swc';

const tsConfigPath = joinPathFragments(context.root, options.tsConfig);
Expand Down Expand Up @@ -205,9 +203,6 @@ export async function createRollupOptions(
main: options.main,
projectRoot: options.projectRoot,
}),
peerDepsExternal({
packageJsonPath: options.project,
}),
postcss({
inject: true,
extract: options.extractCss,
Expand Down Expand Up @@ -297,7 +292,10 @@ export async function createRollupOptions(
...finalConfig,
...config,
plugins: [
...(finalConfig.plugins?.length > 0 ? finalConfig.plugins : []),
...(Array.isArray(finalConfig.plugins) &&
finalConfig.plugins?.length > 0
? finalConfig.plugins
: []),
...(config.plugins?.length > 0 ? config.plugins : []),
],
};
Expand Down
2 changes: 1 addition & 1 deletion packages/rollup/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { calculateHashForCreateNodes } from '@nx/devkit/src/utils/calculate-hash
import { getLockFileName } from '@nx/js';
import { getNamedInputs } from '@nx/devkit/src/utils/get-named-inputs';
import { type RollupOptions } from 'rollup';
import * as loadConfigFile from 'rollup/dist/loadConfigFile';
import { loadConfigFile } from '@nx/devkit/src/utils/config-utils';

const cachePath = join(projectGraphCacheDirectory, 'rollup.hash');
const targetsCache = existsSync(cachePath) ? readTargetsCache() : {};
Expand Down
Loading

0 comments on commit cd3088f

Please sign in to comment.