webpack-emit-static-file-plugin
v1.0.1
Published
Executes code while webpack is building project and emmits as static file
Readme
This plugin allows you to return from a js file string, that will be saved as a file in the output directory.
Constructor of the plugin takes a function that takes a file name and returns a boolean value. If the function returns true, the js code will be replaced by what this code returns. By default it works for all files that not ends with .js.
Example of use
npm install webpack-emit-static-file-pluginwebpack.config.js
export default {
entry: './random.js',
output: {
path: __dirname+'/dist',
filename: 'random.txt'
},
plugins:[new WebpackEmitStaticFilePlugin(name=>name.endsWith('.txt'))]
}random.js
return Math.floor(Math.random()*1000);