I'm having an issue tree-shaking with rollup. I exported a new function min
that does basically nothing from my utils/index.js
module. Along with it in that file there are a ton of imports and other exported functions. When I bundle I'm seeing a compiled file consisting of every external module I'm using as well as all the exported functions in utils/index.js
where I'd expect only min
to be n the bundle and no require
statements. How can I enable tree-shaking? Is there a setting I'm missing?
Here's my entry file.
import { min } from '../utils'
export default min
Here's my rollup.config.js
file.
module.exports = {
external: [],
entry: './src/appProxypass/index.js',
dest: './packages/proxypass-app/index.js',
format: 'cjs',
plugins: [
// require('rollup-plugin-async')({
// exclude: 'node_modules/**'
// }),
// require('rollup-plugin-buble')
// require('rollup-plugin-json')({
// // exclude: 'node_modules/**'
// include: 'node_modules/**'
// }),
// require('rollup-plugin-node-resolve')({
// // main: true,
// // skip: ['axios', 'sqlite3', 'aws-sign2', 'lodash']
// // exclude: './node_modules/axios/**',
// // extensions: [ '.js', '.json' ]
// }),
require('rollup-plugin-commonjs')({
// exclude: 'node_modules/**',
}),
require("rollup-plugin-babel")({
babelrc: false,
// runtimeHelpers: true,
externalHelpers: true,
"presets": [
"es2015-rollup",
"stage-2"
],
"plugins": [
"external-helpers",
"transform-async-to-generator",
"syntax-async-functions",
"transform-flow-strip-types",
// "transform-runtime",
"transform-class-properties",
],
exclude: 'node_modules/**'
}),
// require('rollup-plugin-cleanup')()
]
}