2013-01-31 01:49:25 +08:00
|
|
|
/*
|
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
|
*/
|
2018-07-30 23:08:51 +08:00
|
|
|
|
2017-01-11 23:28:02 +08:00
|
|
|
"use strict";
|
2013-01-31 01:49:25 +08:00
|
|
|
|
2017-01-11 23:28:02 +08:00
|
|
|
const FunctionModuleTemplatePlugin = require("./FunctionModuleTemplatePlugin");
|
|
|
|
|
|
2018-11-03 04:05:46 +08:00
|
|
|
/** @typedef {import("./Compiler")} Compiler */
|
|
|
|
|
|
2017-01-11 23:28:02 +08:00
|
|
|
class FunctionModulePlugin {
|
2018-11-03 04:05:46 +08:00
|
|
|
/**
|
|
|
|
|
* Apply the plugin
|
|
|
|
|
* @param {Compiler} compiler the compiler instance
|
|
|
|
|
* @returns {void}
|
|
|
|
|
*/
|
2017-01-11 23:28:02 +08:00
|
|
|
apply(compiler) {
|
2018-02-25 09:00:20 +08:00
|
|
|
compiler.hooks.compilation.tap("FunctionModulePlugin", compilation => {
|
2018-08-06 16:42:41 +08:00
|
|
|
new FunctionModuleTemplatePlugin({
|
2018-11-17 01:11:51 +08:00
|
|
|
compilation
|
2018-08-06 16:42:41 +08:00
|
|
|
}).apply(compilation.moduleTemplates.javascript);
|
2017-01-11 23:28:02 +08:00
|
|
|
});
|
|
|
|
|
}
|
2013-01-31 01:49:25 +08:00
|
|
|
}
|
2017-01-11 23:28:02 +08:00
|
|
|
|
2013-01-31 01:49:25 +08:00
|
|
|
module.exports = FunctionModulePlugin;
|