webpack-emit-static-file-plugin

1.0.1 • Public • Published

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-plugin

webpack.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);

Readme

Keywords

none

Package Sidebar

Install

npm i webpack-emit-static-file-plugin

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

1.93 kB

Total Files

3

Last publish

Collaborators

  • matrix0123456789