0.4.0 • Published 1 year ago

webpack-expose-package-info-plugin v0.4.0

Weekly downloads
3
License
MIT
Repository
github
Last release
1 year ago

Expose package information

This plugin is useful if you want to expose chosen package information to a bundle created via webpack.

The mechanism uses the DefinePlugin to define a variable that will contain package informations.

Usage

const PackageInfoPlugin = require('webpack-expose-packages-version')

new PackageInfoPlugin({
  packages: ['cozy-bar', 'cozy-ui']
})

Exposed variable

By default the exposed variable is PACKAGES but it can be customized via the varName option.

 new PackageInfoPlugin({
   packages: ['cozy-bar', 'cozy-ui'],
+  varName: 'PACKAGES'
 })

You can now access package information in your app.

/* global PACKAGES */

console.log(PACKAGES)
/* {"cozy-bar": {"version": "1.0.0"}, "cozy-ui": {"version": "6.26.2"}} */

Fields

By default the only information retrieved from the package is the version but you can customize this with the fields options.

 new PackageInfoPlugin({
   packages: ['cozy-bar', 'cozy-ui'],
   varName: 'PACKAGES',
+  fields: ['version', 'repository']
 })
0.4.0

1 year ago

0.3.0

3 years ago

0.2.0

5 years ago

0.1.0

5 years ago