get back old style

This commit is contained in:
Tobias Koppers 2013-03-28 10:19:51 +01:00
parent 7679c75934
commit b5b5cc9372
2 changed files with 9 additions and 4 deletions

View File

@ -3,6 +3,7 @@
Author Tobias Koppers @sokra
*/
var ConcatSource = require("webpack-core/lib/ConcatSource");
var PrefixSource = require("webpack-core/lib/PrefixSource");
function FunctionModuleTemplate(outputOptions, requestShortener) {
this.outputOptions = outputOptions || {};
@ -19,7 +20,7 @@ FunctionModuleTemplate.prototype.render = function(module, dependencyTemplates)
source.add(" \\****" + req.replace(/./g, "*") + "****/\n");
}
source.add("/***/ function(module, exports, require) {\n\n");
source.add(module.source(dependencyTemplates, this.outputOptions, this.requestShortener));
source.add(new PrefixSource("\t", module.source(dependencyTemplates, this.outputOptions, this.requestShortener)));
source.add("\n\n/***/ }");
return source;
};

View File

@ -4,6 +4,7 @@
*/
var ConcatSource = require("webpack-core/lib/ConcatSource");
var OriginalSource = require("webpack-core/lib/OriginalSource");
var PrefixSource = require("webpack-core/lib/PrefixSource");
var Template = require("./Template");
function MainTemplate(outputOptions) {
@ -27,11 +28,14 @@ MainTemplate.prototype.render = function(hash, chunk, moduleTemplate, dependency
buf.push("");
buf.push("// Load entry module and return exports");
buf.push("return " + this.requireFn + "(0);");
var bootstrapSource = new OriginalSource(this.indent(buf), "webpackBootstrap " + hash);
var source = new ConcatSource("(function(modules) { // webpackBootstrap\n", bootstrapSource, "\n})\n");
var source = new ConcatSource();
source.add("/******/(function(modules) { // webpackBootstrap\n");
source.add(new PrefixSource("/******/\t", new OriginalSource(this.asString(buf), "webpackBootstrap " + hash)));
source.add("\n/******/})\n");
source.add("/************************************************************************/\n");
source.add("({\n");
source.add(this.asString(this.renderInitModules(hash, chunk, moduleTemplate, dependencyTemplates)));
source.add("\n");
chunk.modules.forEach(function(module, idx) {
if(idx != 0) source.add(",\n");
source.add("\n/***/ " + module.id + ":\n");
@ -128,7 +132,7 @@ MainTemplate.prototype.renderInit = function(hash, chunk) {
MainTemplate.prototype.renderInitModules = function(hash, chunk, moduleTemplate, dependencyTemplates) {
var publicPath = this.outputOptions.publicPath || "";
return [
"// __webpack_public_path__\n",
"// __webpack_public_path__",
"c: " + JSON.stringify(publicPath.replace(Template.REGEXP_HASH, hash)) + ","
];
};