Skip to content

A Webpack loader to insert data from package.json into a your manifest.json

License

Notifications You must be signed in to change notification settings

bronson/manifest-package-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

manifest-package-loader

This Webpack loader inserts data from package.json into a your manifest.json to ensure it's always up-to-date. (who remembers to update the version field every time?)

This is handy when writing chrome extensions. You may also be interested in the web-accessible resources plugin.

This script was originally written by SO user108471.

The following fields are copied from webpack.json to your manifest.json:

  • name
  • description
  • version
  • author
  • homepage_url

Install

  • yarn add -D manifest-package-loader

Usage

Add a rule to your webpack.config.json:

//  webpack.config.js

module.exports = {
  ...
  module: {
    rules: [
      ...
      {
        test: /^manifest\.json$/,
        use: [
          {
            loader: 'file-loader',
            options: { name: '[name].[ext]' }
          },
          'manifest-package-loader'
        ]
      }
    ]
  }
  ...
}

Make sure to require or import './manifest.json' in any of your javascript files. If you omit this step, Webpack will think the manifest is dead code.

// index.js
import './manifest.json'

Contributing

Please file an issue on GitHub.

Alternatives

License

MIT, be free.

About

A Webpack loader to insert data from package.json into a your manifest.json

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published