-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Use Rollup for bundling dependencies #242
Use Rollup for bundling dependencies #242
Conversation
I don't want to minify the code. Debugging is important. It also doesn't save much anyway. |
They need to be devDependencies, but it would be nice to somehow indicate which are used in production. We could maybe create a custom field like in package.json: |
Would |
I don't think so. It would bundle the dependencies. So we would still have double up of the code (both rolled-up and npm bundled). |
Fair enough. I'll add a custom field. If we're not minimizing, maybe we should only bundle the dependencies?
Avoids the abbreviation problem too, lol |
I think it's easier to simply bundle everything. If we do a separate dependencies file, we need to change all the import statements. |
Whoops, you're right, was thinking a little too fast there. |
I'm not sure when the build script should be run. Pros and cons:
|
@tommy-mitchell FYI, |
Either |
* use `build` instead of `dist` * use `prepare` instead of `prepack` * bundle dependencies in a vendor bundle
Changes:
With Rollup, I was able to separate the dependencies into a separate file and have the imports be updated:
|
I guess it doesn't hurt, but kinda weird that each generated file includes: import 'util';
import 'path';
import 'fs';
import 'url';
import 'node:fs';
import 'os';
import 'node:path';
import 'node:url';
import 'node:process'; |
Looks pretty good |
Have you manually tested it with a CLI to make sure |
I had before, but I went ahead and added a couple of tests using the built output to verify going forward. |
Yeah I'm not sure what's up with that, I need to do some research. |
Managed to fix the empty Node builtin imports. I think this should be good to go. |
@sindresorhus @tommy-mitchell In the old version:
In the new bundled deps version (12.1.1):
No report, although Also, how does security issues are auto checked in this repo? |
I would argue that's an upside. 99% of all npm audits are not actually vulnerabilities (the |
@sindresorhus I agree that audit sucks. Big red "critical" text scares security company monke But as Dan says "Inlining dependencies kind of goes against the whole point of npm", and I feel like we kinda lose any analysis (you might not only use it for security) tools using that approach:
But in the end it's your decision & opinion as a lib owner, as long as you're aware I think its ok |
I generally agree that inlining is bad, but in this specific case, the upsides outweight the downsides. |
I'm on the fence with this change… but also I think it would be great to see it on
At the end of the day bundling is great for this sort of dependencies, but it does force you to release more often than you normally would. This happens for example when a new node version is out and some old issue now needs to be fixed here as well (with a simple sub-dependency patch update) |
Closes #67. Bumps dev dependencies and adds an
_actualDependencies
field.Builds on
prepare
and outputs a bundleddependencies.js
andlicenses.md
to thebuild
folder: