generate-file-webpack-plugin weekly downloads statistics
By kflGALORE · npm · Webpack plugins
General purpose Webpack plugin for generating files.
generate-file-webpack-plugin has 3,244 recorded weekly downloads on npm, an increase of 59.6% over the past 30 days, ranking #1703 of 3,247 tracked listings.
About generate-file-webpack-plugin
generate-file-webpack-plugin
General purpose Webpack plugin for generating files.
<a name="getting-started"></a>
Getting Started
<a name="getting-started--requirements"></a>
Requirements
-
Webpack 4.x
- Earlier version of Webpack probably won't work.
- Latest version 5.x may work, but has not been tested.
-
Node.js 12.x
- Earlier versions may also work, but have not been tested.
- Later versions most probably also work, but have not been tested.
-
npm 6.x
- Earlier versions may also work, but have not been tested.
- Later versions most probably also work, but have not been tested.
<a name="getting-started--install"></a>
Install
Using npm:
npm install generate-file-webpack-plugin --save-dev
Even if not been tested yet, installation using yarn should work without problems:
yarn add generate-file-webpack-plugin --dev
<a name="getting-started--usage"></a>
Usage
webpack.config.js
const generate = require('generate-file-webpack-plugin');
module.exports = {
// ...
plugins: [
generate({
file: 'output.txt',
content: 'Hello World'
})
]
};
Running webpack via your preferred method will generate a file named output.txt in your root output directory with
the content Hello World.
<a name="configuration"></a>
Configuration
webpack.config.js
const generate = require('generate-file-webpack-plugin');
module.exports = {
// ...
plugins: [
generate(options)
]
};
Thereby, options is the main configuration object for this plugin, supporting the following properties:
<a name="configuration--file"></a>
file
The file that is to be generated.
This may either be a relative or an absolute file path. In case it is a relative file path, it will be resolved
relative to the output.path you specified in your webpack configuration.
- type:
string - required: true
- since: 1.0.0
<a name="configuration--content"></a>
content
The content to be written into the specified file.
This property is designed to be quite flexible, in order to cover as much use cases as possible. In its simplest form
it is just a string or a Buffer. But it may also be a Promise that will later resolve to either a string or a
Buffer. Further, it may be a Function that either returns a string or a Buffer, or a Promise resolving to one
of the aforementioned types.
- type:
string|Buffer|Promise<string>|Promise<Buffer>|Function - required: true
- since: 1.0.0
<a name="configuration--debug"></a>
debug
Flag, indicating if additional debug output should be logged.
- type:
boolean - required: false
- default:
false - since: 1.0.0
<a name="examples"></a>
Examples
<a name="examples--copy-file"></a>
Copy File
Given, you have a file my-file.txt in your src directory. Then you can copy that file into webpack's default output
directory like this:
const fs = require('fs');
const generate = require('generate-file-webpack-plugin');
module.exports = {
// ...
plugins: [
generate({
file: 'my-file.txt',
content: fs.readFileSync(path.resolve(__dirname, 'src/my-file.txt'))
})
]
};
Note, that this plugin's intend is not to replace the well known copy webpack plugin. In case you just want to copy over some file into webpack's output directory, you'll probably be better suited to use the copy-webpack-plugin, since it may be easier to use for this case.
Nevertheless, this plugin got some features, that make it extremely useful in more complex scenarios as described in the following examples.
<a name="examples--generate-app-info"></a>
Generate Application Info
Say, you want to generate some metadata information for your app, that is to served by a web server and displayed in your application on demand, you can do it like this:
const fs = require('fs');
const path = require('path');
const generate = require('generate-file-webpack-plugin');
// Load package.json as object
const appPackage = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json')).toString());…
Description from the npm listing.
- webpack
- plugin
- webpack-plugin
- generate
- generator
- file
- files
- create
- creator
- generic
- general-purpose
- helper
- util
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (592)Similar npm Webpack plugins plugins
All 20 generate-file-webpack-plugin alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/generate-file-webpack-plugin. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.