Socket
Socket
Sign inDemoInstall

add-asset-webpack-plugin

Package Overview
Dependencies
70
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    add-asset-webpack-plugin

Dynamically add an asset to the Webpack graph


Version published
Weekly downloads
2.4K
decreased by-35.41%
Maintainers
1
Install size
3.74 kB
Created
Weekly downloads
 

Readme

Source

add-asset-webpack-plugin

Dynamically add an asset to the Webpack graph

Install

$ npm install add-asset-webpack-plugin

Usage

const AddAssetPlugin = require('add-asset-webpack-plugin');

module.exports = {
	// …
	plugins: [
		new AddAssetPlugin('file.js', `
			console.log('This is a dynamically created file');
		`)
	]
};

API

AddAssetPlugin(filePath, source)

filePath

Type: string

Relative file path for the asset.

source

Type: string | (compilation => string | Promise<string>)

Asset source or a function that returns the asset source.

If a function, it will receive the compilation instance. And if the function returns a promise, it will be awaited.

Keywords

FAQs

Last updated on 17 Feb 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc