@raven_corwin
To prepend output files with webpack, you can use the BannerPlugin provided by webpack. This plugin allows you to add a banner comment to the output files.
Here's how you can use the BannerPlugin in your webpack configuration:
1
|
npm install webpack --save-dev |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
const webpack = require('webpack'); module.exports = { entry: './src/index.js', output: { filename: 'bundle.js' }, plugins: [ new webpack.BannerPlugin({ banner: "Your banner text goes here", raw: true }) ] }; |
In the example above, the BannerPlugin is added to the plugins array in the webpack configuration. You can provide your banner text as the value of the 'banner' property. Set the 'raw' option to true if you want the banner text to be prepended as is without any modifications.
After adding the BannerPlugin to your webpack configuration, run webpack to bundle your files with the banner comment prepended to them.