Skip to content

Commit

Permalink
chore: remove replace rollup plugin (#1274)
Browse files Browse the repository at this point in the history
The repo doesn't even use protobuf.js anymore and instead relies on @bufbuild/protobuf-es, so this can be safely removed. Before and after the esm bundle size was 788.4KB, which means the plugin was doing nothing.
  • Loading branch information
ryanleecode authored Oct 7, 2024
1 parent c5b9888 commit eb9043b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 67 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
"prettier": "^3.0.0",
"rollup": "4.24.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-re": "1.0.7",
"rollup-plugin-typescript2": "0.36.0",
"size-limit": "^8.2.4",
"typedoc": "0.26.7",
Expand Down
43 changes: 4 additions & 39 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 1 addition & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import json from '@rollup/plugin-json';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import del from 'rollup-plugin-delete';
import replace from 'rollup-plugin-re';
import typescript from 'rollup-plugin-typescript2';
import packageJson from './package.json';

Expand Down Expand Up @@ -55,18 +54,6 @@ export default {
plugins: [
del({ targets: 'dist/*' }),
typescript({ tsconfig: './tsconfig.json' }),
...commonPlugins,
replace({
patterns: [
{
// protobuf.js uses `eval` to determine whether a module is present or not
// in most modern browsers this will fail anyways due to CSP, and it's safer to just replace it with `undefined`
// until this PR is merged: https://github.com/protobufjs/protobuf.js/pull/1548
// related discussion: https://github.com/protobufjs/protobuf.js/issues/593
test: /eval.*\(moduleName\);/g,
replace: 'undefined;',
},
],
}),
...commonPlugins
],
};
13 changes: 0 additions & 13 deletions vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { babel } from '@rollup/plugin-babel';
import dns from 'dns';
import { resolve } from 'path';
import replace from 'rollup-plugin-re';
import { defineConfig } from 'vite';

dns.setDefaultResultOrder('verbatim');
Expand Down Expand Up @@ -34,18 +33,6 @@ export default defineConfig({
presets: ['@babel/preset-env'],
extensions: ['.js', '.ts', '.mjs'],
}),
replace({
patterns: [
{
// protobuf.js uses `eval` to determine whether a module is present or not
// in most modern browsers this will fail anyways due to CSP, and it's safer to just replace it with `undefined`
// until this PR is merged: https://github.com/protobufjs/protobuf.js/pull/1548
// related discussion: https://github.com/protobufjs/protobuf.js/issues/593
test: /eval.*\(moduleName\);/g,
replace: 'undefined;',
},
],
}),
],
},
},
Expand Down

0 comments on commit eb9043b

Please sign in to comment.