$ cnpm install add-asset-webpack-plugin
Dynamically add an asset to the Webpack graph
$ npm install add-asset-webpack-plugin
const AddAssetPlugin = require('add-asset-webpack-plugin');
module.exports = {
// …
plugins: [
new AddAssetPlugin('file.js', `
console.log('This is a dynamically created file');
`)
]
};
Type: string
Relative file path for the asset.
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.
NODE_ENV
handlingmodule.exports
for Babel and TypeScript compiled codeMIT © Sindre Sorhus
Copyright 2013 - present © cnpmjs.org