webpack/lib/EvalSourceMapDevToolPlugin.js

20 lines
815 B
JavaScript
Raw Normal View History

2014-02-13 18:40:16 +08:00
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var EvalSourceMapDevToolModuleTemplatePlugin = require("./EvalSourceMapDevToolModuleTemplatePlugin");
2014-02-13 18:40:16 +08:00
2014-07-18 19:31:50 +08:00
function EvalSourceMapDevToolPlugin(sourceMapComment, moduleFilenameTemplate) {
2014-02-13 18:40:16 +08:00
this.sourceMapComment = sourceMapComment;
2014-07-18 19:31:50 +08:00
this.moduleFilenameTemplate = moduleFilenameTemplate;
2014-02-13 18:40:16 +08:00
}
module.exports = EvalSourceMapDevToolPlugin;
EvalSourceMapDevToolPlugin.prototype.apply = function(compiler) {
2014-07-18 19:31:50 +08:00
var self = this;
2014-02-13 18:40:16 +08:00
compiler.plugin("compilation", function(compilation) {
compilation.plugin("build-module", function(module) {
module.useSourceMap = true;
});
2014-07-18 19:31:50 +08:00
compilation.moduleTemplate.apply(new EvalSourceMapDevToolModuleTemplatePlugin(compilation, self.sourceMapComment, self.moduleFilenameTemplate));
2014-02-13 18:40:16 +08:00
});
};