Skip to content

Commit

Permalink
feat(build): Upgrade to @rollup/plugin-terser and add to rrweb build
Browse files Browse the repository at this point in the history
* `rollup-plugin-terser` is unmaintained, upgrade to `@rollup/plugin-terser`
* The `rrweb` package was not using terser, adds terser to minified builds
  • Loading branch information
billyvg committed Oct 23, 2023
1 parent 8444cb2 commit c35ea49
Show file tree
Hide file tree
Showing 11 changed files with 199 additions and 2,466 deletions.
2 changes: 1 addition & 1 deletion packages/rrdom-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"devDependencies": {
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-terser": "^0.4.3",
"@types/cssom": "^0.4.1",
"@types/cssstyle": "^2.2.1",
"@types/jest": "^27.4.1",
Expand All @@ -39,7 +40,6 @@
"jest": "^27.5.1",
"puppeteer": "^9.1.1",
"rollup": "^2.56.3",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"rollup-plugin-web-worker-loader": "^1.6.1",
"ts-jest": "^27.1.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/rrdom-nodejs/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import terser from '@rollup/plugin-terser';
import typescript from 'rollup-plugin-typescript2';
import webWorkerLoader from 'rollup-plugin-web-worker-loader';
import pkg from './package.json';
Expand Down
2 changes: 1 addition & 1 deletion packages/rrdom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"devDependencies": {
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-terser": "^0.4.3",
"@rrweb/types": "^2.0.0-alpha.11",
"@types/jest": "^27.4.1",
"@types/puppeteer": "^5.4.4",
Expand All @@ -41,7 +42,6 @@
"jest": "^27.5.1",
"puppeteer": "^17.1.3",
"rollup": "^2.56.3",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"rollup-plugin-web-worker-loader": "^1.6.1",
"ts-jest": "^27.1.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/rrdom/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import terser from '@rollup/plugin-terser';
import typescript from 'rollup-plugin-typescript2';
import webWorkerLoader from 'rollup-plugin-web-worker-loader';
import pkg from './package.json';
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb-player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"@rollup/plugin-terser": "^0.4.3",
"@rrweb/types": "^2.0.0-alpha.11",
"@types/offscreencanvas": "^2019.6.4",
"eslint-config-google": "^0.14.0",
Expand All @@ -13,7 +14,6 @@
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"rollup-plugin-web-worker-loader": "^1.6.1",
"sirv-cli": "^0.4.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb-player/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import svelte from 'rollup-plugin-svelte';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import terser from '@rollup/plugin-terser';
import sveltePreprocess from 'svelte-preprocess';
import webWorkerLoader from 'rollup-plugin-web-worker-loader';
import typescript from 'rollup-plugin-typescript2';
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb-snapshot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
},
"homepage": "https://github.com/rrweb-io/rrweb/tree/master/packages/rrweb-snapshot#readme",
"devDependencies": {
"@rollup/plugin-terser": "^0.4.3",
"@types/chai": "^4.1.4",
"@types/jest": "^27.0.2",
"@types/jsdom": "^20.0.0",
Expand All @@ -53,7 +54,6 @@
"jsdom": "^16.4.0",
"puppeteer": "^17.1.3",
"rollup": "^2.45.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"ts-jest": "^27.0.5",
"ts-node": "^7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb-snapshot/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import typescript from 'rollup-plugin-typescript2';
import { terser } from 'rollup-plugin-terser';
import terser from '@rollup/plugin-terser';
import pkg from './package.json';

function toMinPath(path) {
Expand Down
1 change: 1 addition & 0 deletions packages/rrweb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"homepage": "https://github.com/rrweb-io/rrweb#readme",
"devDependencies": {
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-terser": "^0.4.3",
"@types/chai": "^4.1.6",
"@types/dom-mediacapture-transform": "0.1.4",
"@types/inquirer": "^8.2.1",
Expand Down
10 changes: 6 additions & 4 deletions packages/rrweb/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import typescript from 'rollup-plugin-typescript2';
import esbuild from 'rollup-plugin-esbuild';
import resolve from '@rollup/plugin-node-resolve';
import postcss from 'rollup-plugin-postcss';
import terser from '@rollup/plugin-terser';
import renameNodeModules from 'rollup-plugin-rename-node-modules';
import webWorkerLoader from 'rollup-plugin-web-worker-loader';
import pkg from './package.json';
Expand Down Expand Up @@ -137,11 +138,12 @@ function getPlugins(options = {}) {
minimize: minify,
sourceMap,
}),
...(minify ? [terser()] : []),
];
}

for (const c of baseConfigs) {
const basePlugins = [
const plugins = [
resolve({ browser: true }),

// supports bundling `web-worker:..filename`
Expand All @@ -152,13 +154,13 @@ for (const c of baseConfigs) {
}),

typescript(),
];
const plugins = basePlugins.concat(

postcss({
extract: false,
inject: false,
}),
);
];

// browser
configs.push({
input: c.input,
Expand Down
Loading

0 comments on commit c35ea49

Please sign in to comment.