Skip to content

Commit

Permalink
Do not minify common code.
Browse files Browse the repository at this point in the history
  • Loading branch information
kinyoklion committed Oct 1, 2024
1 parent bbde020 commit 9e1784c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions packages/shared/common/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import common from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import { visualizer } from "rollup-plugin-visualizer";


// The common library does not have a dependency resolution plugin as it should not have any
// dependencies.

// This library is not minified as the final SDK package is responsible for minification.

const getSharedConfig = (format, file) => ({
input: 'src/index.ts',
// Intermediate modules don't bundle all dependencies. We leave that to leaf-node
Expand Down Expand Up @@ -38,15 +41,13 @@ export default [
transformMixedEsModules: true,
esmExternals: true,
}),
// resolve(),
terser(),
json(),
// The 'sourcemap' option allows using the minified size, not the size before minification.
visualizer({ sourcemap: true }),
],
},
{
...getSharedConfig('cjs', 'dist/index.cjs.js'),
plugins: [typescript({ tsconfig: './tsconfig.json' }), common(), resolve(), terser(), json()],
plugins: [typescript({ tsconfig: './tsconfig.json' }), common(), json()],
},
];
6 changes: 3 additions & 3 deletions packages/shared/sdk-client/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import common from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import { visualizer } from "rollup-plugin-visualizer";

// This library is not minified as the final SDK package is responsible for minification.

const getSharedConfig = (format, file) => ({
input: 'src/index.ts',
// Intermediate modules don't bundle all dependencies. We leave that to leaf-node
Expand Down Expand Up @@ -38,14 +39,13 @@ export default [
esmExternals: true,
}),
resolve(),
terser(),
json(),
// The 'sourcemap' option allows using the minified size, not the size before minification.
visualizer({ sourcemap: true }),
],
},
{
...getSharedConfig('cjs', 'dist/index.cjs.js'),
plugins: [typescript({ tsconfig: './tsconfig.json' }), common(), resolve(), terser(), json()],
plugins: [typescript({ tsconfig: './tsconfig.json' }), common(), resolve(), json()],
},
];

0 comments on commit 9e1784c

Please sign in to comment.