Open avocadowastaken opened 5 years ago
Hey @umidbekkarimov, thanks for taking such a deep look into this, it's really appreciated.
I just went through your PRs, but don't have time now to respond to these remaining, larger issues in full now. Let me think through them a bit tomorrow and then respond then.
Hello @FredKSchott! No problems at all, it took me about a week to came up with this proposals. And I'm using local config, so no blockers from you.
While trying to bundle cli app with
@pika/plugin-bundle-node
I found few problems:It bundles all externals, even if they are in
dependencies
orpeerDependencies
, so these dependencies will be bundled and installed. Solution: Notify user if there aredependencies
orpeerDependencies
inpackage.json
and add them toexternals
.Same thing as 1., but with optional dependencies (not
optionalDependencies
), which not listed inpackage.json
, but can be used with module. (e.g.pg
,mysql
packages that not listed inpackage.json
of orm packages) Solution: Add option to passexternals
. (Also can be as solution for 1.)I was using
ink
andreact
to build cli interface, and both of these libs requires to listnamedExports
inrollup-plugin-commonjs
. Solution: Add option to passnamedExports
for each module.As I said in 3., I was using
react
which hasNODE_ENV
checks inside, that's why bundle becomes really big. Solution 1: Always passprocess.env.NODE_ENV=production
withrollup-plugin-replace
. Solution 2: Add option to passenv
variables and replace them withrollup-plugin-replace
.Does not work without
@pika/plugin-build-node
. Solution: Usedist-node/index.bundle.js
only ifdist-node/index.js
wasn't created. Otherwise output todist-node/index.js
and do not skip bundle without--publish
flag. (We also will need incremental builds for this, related to https://github.com/pikapkg/pack/issues/29)From minor problems I found that there are no way to pass
minNodeVersion
androllup-plugin-node-resolve
warns about deprecatedmodule
option. I'll create PRs for them, but really want to discuss listed issues.Update:
minNodeVersion
option. (#38)mainFields
option forrollup-plugin-node-resolve
. (#39)Update 2: