webpack
Version:
Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.
23 lines (21 loc) • 947 B
JavaScript
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var NodeMainTemplatePlugin = require("./NodeMainTemplatePlugin");
var NodeChunkTemplatePlugin = require("./NodeChunkTemplatePlugin");
var NodeHotUpdateChunkTemplatePlugin = require("./NodeHotUpdateChunkTemplatePlugin");
function NodeTemplatePlugin(options, asyncChunkLoading) {
// TODO remove options parameter
this.options = options;
this.asyncChunkLoading = asyncChunkLoading;
}
module.exports = NodeTemplatePlugin;
NodeTemplatePlugin.prototype.apply = function(compiler) {
var options = this.options;
compiler.plugin("this-compilation", function(compilation) {
compilation.mainTemplate.apply(new NodeMainTemplatePlugin(this.asyncChunkLoading));
compilation.chunkTemplate.apply(new NodeChunkTemplatePlugin());
compilation.hotUpdateChunkTemplate.apply(new NodeHotUpdateChunkTemplatePlugin());
}.bind(this));
};