developit / microbundle

📦 Zero-configuration bundler for tiny modules.

Home Page:https://npm.im/microbundle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Install only necessary bundling dependencies

ksenginew opened this issue · comments

currently microbundle installs a lot of dependencies with it.

microbundle/package.json

Lines 70 to 113 in 105a09b

"dependencies": {
"@babel/core": "^7.12.10",
"@babel/plugin-proposal-class-properties": "7.12.1",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-syntax-jsx": "^7.12.1",
"@babel/plugin-transform-flow-strip-types": "^7.12.10",
"@babel/plugin-transform-react-jsx": "^7.12.11",
"@babel/plugin-transform-regenerator": "^7.12.1",
"@babel/preset-env": "^7.12.11",
"@babel/preset-flow": "^7.12.1",
"@babel/preset-react": "^7.12.10",
"@rollup/plugin-alias": "^3.1.1",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.0.1",
"@surma/rollup-plugin-off-main-thread": "^2.2.2",
"asyncro": "^3.0.0",
"autoprefixer": "^10.1.0",
"babel-plugin-macros": "^3.0.1",
"babel-plugin-transform-async-to-promises": "^0.8.18",
"babel-plugin-transform-replace-expressions": "^0.2.0",
"brotli-size": "^4.0.0",
"builtin-modules": "^3.1.0",
"camelcase": "^6.2.0",
"escape-string-regexp": "^4.0.0",
"filesize": "^6.1.0",
"gzip-size": "^6.0.0",
"kleur": "^4.1.3",
"lodash.merge": "^4.6.2",
"postcss": "^8.2.1",
"pretty-bytes": "^5.4.1",
"rollup": "^2.35.1",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.32.0",
"rollup-plugin-visualizer": "^5.6.0",
"sade": "^1.7.4",
"terser": "^5.7.0",
"tiny-glob": "^0.2.8",
"tslib": "^2.0.3",
"typescript": "^4.1.3"
},

but some of these are not useful for some users as they don't use that things in their package.
As an example:- for a JavaScript library without any typescript code doesn't require typescript tslib of any other typescript related build tools. so it would be bedder if you can mark these dependencies as optional with peerDependenciesMeta option. this would make small install times and faster builds.

Thank you for this great project. I would be like to make a pr for this improvement.

this would make small install times and faster builds

Any benefit from fewer deps is almost certainly offset by the poor DX that is users needing to wrangle peerDeps if they want Microbundle to build CSS or TS.

Build times shouldn't be affected in any way.

@rschristian I think installing packages like typescript is useless for a pure js codebase. Anyway thanks for the clarification. 😸

TS can also be used to generate TS types for JS sources, for what it's worth. It's not something limited to those who author in TS.

I agree, the situation isn't ideal, but peer dependencies aren't a great DX. Slightly reducing the download size isn't worth it IMO.

I'm going to close this out as I don't think it's something worth pursuing.