Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include comment at top of webpack file

Tags:

I'm using webpack to bundle a bunch of javascript files together, and I need to include a copyright notice at the top of the file. I can't seem to figure out how to do that, or if it is possible.

The closest I've come is to use the raw loader, but that hides the copyright in an exported function. Any idea.

Something that is cross-platform is preferred.

like image 628
pedalpete Avatar asked Dec 15 '15 02:12

pedalpete


1 Answers

You can use the webpack BannerPlugin. With this plugin you can add any string you want at the top of your bundled file.

I have used it to add some package name, version, license, and other info at the top of a library of my own.

webpack.config.js

module.exports = {   // Other stuff   plugins: [     new webpack.BannerPlugin('Your copyright notice')   ] }; 
like image 159
dreyescat Avatar answered Sep 22 '22 05:09

dreyescat