Include a comment at the beginning of the webpack file

I use webpack to link a bunch of javascript files together, and I need to include a copyright notice at the top of the file. I cannot figure out how to do this, or if it is possible.

The closest I came to is using a raw bootloader, but this hides the copyright in the exported function. Any ideas.

Something that is cross-platform is preferred.

+6
source share
1 answer

You can use webpack BannerPlugin . With this plugin, you can add any line you want at the top of your linked file.

I used it to add the package name, version, license and other information at the top of my library .

webpack.config.js

module.exports = { // Other stuff plugins: [ new webpack.BannerPlugin('Your copyright notice') ] }; 
+13
source

All Articles