Package Exports
- write-to-file-webpack
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (write-to-file-webpack) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Write to file plugin for webpack(v4)
This is a simple webpack plugin for writing data to file.
Installation
npm install --save-dev write-to-file-webpack
Usage
The data to be written can be either a simple javascript variable, or a function which returns some data.
const WriteToFilePlugin = require('write-to-file-webpack');
module.exports = {
...
plugins: [
new WriteToFilePlugin({
filename: 'path/to/write/file',
data: function () {
return "console.log('write to file')"
}
})
]
...
}
const WriteToFilePlugin = require('write-to-file-webpack');
module.exports = {
...
plugins: [
new WriteToFilePlugin({
filename: 'path/to/write/file',
data: 'console.log("write to file")'
})
]
...
}
Support
node >= 6
and webpack >= 4
List of options:
- filename
- data
- encoding
<string> | <null> Default: 'utf8'
- mode
<integer> Default: 0o666
- flag
<string> Default: 'w'
For more information about encoding
, mode
, and flag
please refer to node writeFile.