
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
package-size
Advanced tools
yarn global add package-size
The package is bundled with Webpack.
# get the size of vue bundle
package-size vue
# get the size of react+react-dom bundle
package-size react,react-dom
# get the size of vue react+react-dom preact bundles
package-size vue react,react-dom preact
# get the size of react+react-dom without using the cache
package-size react,react-dom --no-cache
# get the size of file in current working directory
package-size ./dist/index.js
# or a package in current working directory, explictly using `--cwd` flag
package-size vue --cwd
# or event multiple versions for the same package!
package-size react@0.10 react@0.14 react@15
# save results to file system in JSON format
# defaults to ./package-size-output.json
package-size cherow --output
# or custom path
package-size cherow --output stats.json
# analyze bundle with webpack-bundle-analyzer
package-size cherow --analyze
# analyze bundle with webpack-bundle-analyzer on a different port
package-size cherow --analyze --port 9000
const getSizes = require('package-size')
getSizes('react,react-dom', options)
.then(data => {
console.log(data)
//=>
{
name: 'react,react-dom',
size: 12023, // in bytes
minified: 2342,
gzipped: 534,
versionedName: 'react@16.0.0,react-dom@16.0.0'
}
})
Type: boolean
Default: false
Sort packages in size (from small to large).
Type: boolean
Default: false
Resolve modules in current working directory instead of a cache folder. Relative path will set cwd
to true
by default.
Type: string
or Array<string|RegExp>
Default: undefined
The package to exclude from bundled file, for example, to get the bundle size of styled-jsx/style
we need to exclude react
:
package-size styled-jsx/style --externals react
Note that if some item in externals
is provided as string, it will be wrapped in a regular expression. For example: react
is treated as /^react$/
Type: boolean
Default: true
If cache
is set to false
, then package-size will not use cached build sizes. To use this from the CLI, pass --no-cache
as an argument.
Type: string
Default: browser
Values: browser
node
Build target. In node
target, all node_modules will be excluded and output format is set to CommonJS.
Type: string
Default: undefined
npm registry to install the package from. By default it uses the default npm registry.
Type: string
string[]
Default: undefined
Extra folders to resolve local node_modules from.
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
package-size © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).
egoist.moe · GitHub @egoist · Twitter @_egoistlily
FAQs
Get real size of an npm package after bundled.
The npm package package-size receives a total of 111 weekly downloads. As such, package-size popularity was classified as not popular.
We found that package-size demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.