-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support non-bundler setups #123
Comments
I did an experiment for this here: #71 What I found was that introducing a bundler to a project without one might not be the best approach here. What we probably want to do is the following:
|
I really really like this idea, and glad someone mentioned it 😂 This is where I wish we had an |
A separate CLI would work OK, but it's be really nice if y'all could have |
We rely on the bundlers to generate stats for us to upload, but this means we have no current solution for bundlerless setups.
What we can do is to wrap rollup ourselves in a separate package and export a CLI tool that will take some input files, run it through rollup, and send the bundle stats to Sentry. This will mean that tree-shaking also gets automatically applied, which is important to keep in mind.
Usage:
Under the hood
@codecov/bundle-analyze
first will look forpackage.json
(if it's not already set) and check if it's defined in it'smain
,module
, andexports
fields. See the module docs for more info about those fields. These become the main bundles that we analyze.For each bundle, we call a small rollup script that takes in the entrypoint and outputs stats. To maintain accuracy we enable
preserveModules
and don't do any polyfilling or replacements, which means we basically just use rollup to treeshake and walk the dependency tree (and get stats as a side effect hoho).Let's look at an example, the dotenv package: https://github.com/motdotla/dotenv.
https://github.com/motdotla/dotenv/blob/f6e87eb03705e4b8abcc159ef88e4c0f2992ced4/package.json#L5-L20
Based on the
package.json
We'd get the following bundles:
lib_main.js
,config_js
,lib_env-options.js
,lob-cli-options.js
.edge cases:
The text was updated successfully, but these errors were encountered: