-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Parcel 2: Better node support #2493
Comments
just a feedback, tried to use parcel for serverless, didn't do too hot because the way parcel 1 greedily tries to take care of everything. bundle size with parcel: 13MB, bundle size with serverless-webpack: 31kb |
Are you talking about not bundling node_modules? |
yes, selectively not bundling stuff (like aws-sdk that is already available in lambda, but many others), also failed for some modules like |
It would also be great if you configure parcel to exclude node_modules, it still hooks require so it can rewrite imports based on aliases in the package json. |
Not bundling Why would someone want to transpile |
As for bundling |
The only difference is having a self contained JS file that starts up slightly faster. |
Ok I see -- so Parcel would only bundle |
I'm also trying to use Parcel to bundle my AWS Lambda functions. Because of I think a config for excluding dependencies from bundle or not including devDependencies in the bundle even if it's imported, can be helpful. |
Just want to point out that #2934 was closed as a duplicate (of this issue? thanks @mischnic for point it out) but I don't see any mention of running the script when using It should be an easy addition, right? Maybe one open question is, if multiple entries are specified, should each one be run? And do all instances get restarted on any change? |
This is a matter of copying the built node files to the dist folder and update the URL. Can't we do it now?
I have created a separate issue for _dirname |
Any progress on this? I'm using express for a simple back-end server. Does Parcel provide HMR for express? I read in #355 that Parcel 1 had an express middleware. Is there something similar available for Parcel 2? Or is there another way to do it? |
Parcel 1 has a node target, but it is not super well baked. We should improve on it for Parcel 2 and make a great Node build experience for Parcel users.
.node
) by copying them to thedist
directory.fs
calls to thedist
directory. We already have support for inlining fs calls for browser targets, but we currently don't do anything in Node. Rather than inlining, we can just copy them and let node read them at runtime.__dirname
and__filename
. Currently we don't do this for Node targets, but we probably should so that they refer to the source file rather than the dist.node_modules
by default? (not sure about this)parcel-node
?). See Parcel 2:@parcel/register
node require hook #2396.require
cost.Related: #2492, #2396, #2345.
The zeit team have created
ncc
, which solves many of these issues. We should look at getting their integration tests running against Parcel as well.Please comment with other suggestions for ways we can improve Node bundling in Parcel! 😄
cc. @rauchg @guybedford since you know about a lot of edge cases you've run into with
ncc
. 😉The text was updated successfully, but these errors were encountered: