You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.
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 or peerDependencies, so these dependencies will be bundled and installed. Solution: Notify user if there are dependencies or peerDependencies in package.json and add them to externals.
Same thing as 1., but with optional dependencies (not optionalDependencies), which not listed in package.json, but can be used with module. (e.g. pg, mysql packages that not listed in package.json of orm packages) Solution: Add option to pass externals. (Also can be as solution for 1.)
I was using ink and react to build cli interface, and both of these libs requires to list namedExports in rollup-plugin-commonjs. Solution: Add option to pass namedExports for each module.
As I said in 3., I was using react which has NODE_ENV checks inside, that's why bundle becomes really big. Solution 1: Always pass process.env.NODE_ENV=production with rollup-plugin-replace. Solution 2: Add option to pass env variables and replace them with rollup-plugin-replace.
Does not work without @pika/plugin-build-node. Solution: Use dist-node/index.bundle.js only if dist-node/index.js wasn't created. Otherwise output to dist-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 and rollup-plugin-node-resolve warns about deprecated module option. I'll create PRs for them, but really want to discuss listed issues.
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.
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 are
dependencies
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 pass
externals
. (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 pass
namedExports
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 pass
process.env.NODE_ENV=production
withrollup-plugin-replace
.Solution 2: Add option to pass
env
variables and replace them withrollup-plugin-replace
.Does not work without
@pika/plugin-build-node
.Solution: Use
dist-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. (feat(plugin-bundle-node): AddminNodeVersion
option. #38)mainFields
option forrollup-plugin-node-resolve
. (feat(plugin-bundle-node): UsemainFields
option forrollup-plugin-node-resolve
. #39)Update 2:
The text was updated successfully, but these errors were encountered: