create-file-webpack-plugin
Version:
Webpack plugin for creating a file with static or dynamic content
56 lines (32 loc) • 992 B
Markdown
> [Webpack](https://webpack.js.org) plugin for creating a file with static or dynamic content
```
$ npm install create-file-webpack-plugin --save-dev
```
```js
const CreateFilePlugin = require('create-file-webpack-plugin');
module.exports = {
// …
plugins: [
new CreateFilePlugin('file.js', `
console.log('This is a dynamically created file');
`)
]
};
```
Type: `string`
Relative path to where the file should be created
Type: `string`
Name of file to be created
Type: `string | (({filePath, fileName, compilation}) => string)`
File content or a function that returns the file content.
If a function, it will receive an object with the following data `filePath`, `fileName` and [`compilation` instance](https://webpack.js.org/api/compilation/).
MIT © [Ricard Fredin](https://github.com/cordazar)