Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webpack-assets-manifest

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-assets-manifest

This Webpack plugin will generate a JSON file that matches the original filename with the hashed version.

  • 5.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
711K
increased by1.38%
Maintainers
1
Weekly downloads
 
Created

What is webpack-assets-manifest?

The webpack-assets-manifest npm package is a Webpack plugin that generates a JSON file containing the mappings of all your output files. This is particularly useful for cache busting and managing asset paths in your application.

What are webpack-assets-manifest's main functionalities?

Generate Asset Manifest

This feature allows you to generate a JSON file (assets.json) that contains the mappings of your output files. This is useful for keeping track of your assets and their hashed versions.

const WebpackAssetsManifest = require('webpack-assets-manifest');

module.exports = {
  plugins: [
    new WebpackAssetsManifest({
      output: 'assets.json'
    })
  ]
};

Customize Manifest Content

This feature allows you to customize the content of the manifest file. For example, you can modify the paths of JavaScript files to include a specific directory.

const WebpackAssetsManifest = require('webpack-assets-manifest');

module.exports = {
  plugins: [
    new WebpackAssetsManifest({
      customize: (entry, original, manifest, asset) => {
        if (entry.key.endsWith('.js')) {
          entry.value = `/static/js/${entry.value}`;
        }
        return entry;
      }
    })
  ]
};

Integrate with Webpack Dev Server

This feature allows you to integrate the manifest with the Webpack Dev Server. You can serve the manifest file via an endpoint, making it accessible during development.

const WebpackAssetsManifest = require('webpack-assets-manifest');

module.exports = {
  devServer: {
    before: (app, server) => {
      const manifest = server.compiler.options.plugins.find(
        plugin => plugin instanceof WebpackAssetsManifest
      );
      app.get('/assets.json', (req, res) => {
        res.json(manifest.getRawManifest());
      });
    }
  },
  plugins: [
    new WebpackAssetsManifest()
  ]
};

Other packages similar to webpack-assets-manifest

Keywords

FAQs

Package last updated on 24 Feb 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc