SvenWalter / webpack-war-archiver-plugin

0 stars 2 forks source link

war is empty #3

Open wadhwanin opened 8 years ago

wadhwanin commented 8 years ago

I don't know how this works.

Where are the parameters getting used?

module.exports = { plugins: [ new WarArchiverPlugin({ fileName: "project-name.war", rootFolder: "project-name", dir: "." //this is an extra parameter that is being consumed but not defined. }) ] }

function WarArchiverPlugin(options) { console.log(options); this.options = options || {}; this.fileName = options.fileName || 'project.zip'; this.rootFolder = options.dir || 'project'; }

WarArchiverPlugin.prototype.apply = function(compiler) { var self = this; var options = compiler.options; options.output.path = this.rootFolder; console.log(options); // I added above two lines and then war was created ... without it, war was empty. How will it automatically understand this path? compiler.plugin('done', function() { var zip = new EasyZip(); zip.zipFolder(options.output.path, function() { zip.writeToFile(path.join(options.output.path, '..', self.fileName)); }, { rootFolder: self.rootFolder }); }); };