webpack/lib/node/NodeTemplatePlugin.js

28 lines
864 B
JavaScript
Raw Normal View History

2013-01-31 01:49:25 +08:00
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const NodeMainTemplatePlugin = require("./NodeMainTemplatePlugin");
const NodeChunkTemplatePlugin = require("./NodeChunkTemplatePlugin");
const NodeHotUpdateChunkTemplatePlugin = require("./NodeHotUpdateChunkTemplatePlugin");
class NodeTemplatePlugin {
constructor(options) {
options = options || {};
this.asyncChunkLoading = options.asyncChunkLoading;
}
apply(compiler) {
2017-12-06 22:01:25 +08:00
compiler.hooks.thisCompilation.tap("NodeTemplatePlugin", (compilation) => {
new NodeMainTemplatePlugin(this.asyncChunkLoading).apply(compilation.mainTemplate);
new NodeChunkTemplatePlugin().apply(compilation.chunkTemplate);
new NodeHotUpdateChunkTemplatePlugin().apply(compilation.hotUpdateChunkTemplate);
});
}
2013-01-31 01:49:25 +08:00
}
2013-03-01 16:44:58 +08:00
module.exports = NodeTemplatePlugin;