Add arbitrary assets to a Webpack build
npm install --save-dev add-assets-webpack-plugin
or
yarn add -D add-assets-webpack-plugin
new AddAssetsWebpackPlugin({
filePath: "static/file.txt",
content: 'Contents of the file'
})
filePath
: The file name (and path), relative to the webpack output directory
contents
: The desired contents of the file
The constructor can take an object, or an array of objects:
new AddAssetsWebpackPlugin([
{
filePath: ".env",
content: process.env.NODE_ENV
},
{
filePath: "other.txt",
content: 'eyy lmao'
}
])