So I'm using bundlephobia to audit the bundle size of my packages. Bundlephobia has a section called "Export Analysis" that gives you the bundle size of the individual exports.
So each of these functions in this bundle are pure functions so, unless I'm missing something, I think these should show a smaller size for each function but all of them (except the re-exported one) have the same size.
I tried:
- Adding
"sideEffects": false"
to mypackage.json
- Marking every function with
#__PURE__
I'm using rollup and this is my rollup config:
// rollup.config.js
import babel from '@rollup/plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
const extensions = ['.js', '.ts', '.tsx'];
export default [
{
input: './src/index.ts',
plugins: [
resolve({
extensions,
}),
babel({
babelrc: false,
presets: ['@babel/preset-env', '@babel/preset-typescript'],
babelHelpers: 'bundled',
extensions,
}),
],
output: {
file: 'dist/index.js',
format: 'umd',
name: 'parseToRgba',
sourcemap: true,
},
},
{
input: './src/index.ts',
plugins: [
resolve({
extensions,
modulesOnly: true,
}),
babel({
babelrc: false,
presets: ['@babel/preset-typescript'],
plugins: ['@babel/plugin-transform-runtime'],
babelHelpers: 'runtime',
extensions,
}),
],
output: {
file: 'dist/index.esm.js',
format: 'esm',
sourcemap: true,
},
external: ['@ricokahler/parse-to-rgba'],
},
];
Nothin.
How do I do this?