Closed manzt closed 4 years ago
@jbms - would you mind editing node_modules/numcodecs.js/package.json
for your project, adding "sideEffects": false,
and seeing if it fixes your issues? I will then merge and make a new release for you.
The "sideEffects" property also seems to be used by @rollup/plugin-node-resolve
:
index.js
import { Blosc } from 'numcodecs';
const codec = new Blosc();
rollup.config.js
import resolve from '@rollup/plugin-node-resolve';
export default {
input: './index.js',
output: {
file: './bundle.js',
format: 'es'
},
plugins: [
resolve()
]
}
$ rollup -c
now produces an output with only blosc codec (which it did not before).
Thanks for looking into this. Yes, I can confirm that setting "sideEffects": false fixes the issue.
Great, thanks for checking!
I'm not very experienced with webpack, but I saw this in the docs on tree-shaking:
Since all exports (codecs) are side effect free in numcodecs, I added this to the repo's
package.json
. This seemed to fix #9, removing unused codecs from the final webpack bundle in my brief experimenting:index.js
webpack.config.js