refactor: dead code elimination

remove those code not defined but used;
remove unused code
This commit is contained in:
e-cloud 2017-03-18 20:38:47 +08:00
parent 59e5de59d7
commit 52055ba07e
4 changed files with 3 additions and 11 deletions

View File

@ -65,7 +65,7 @@ ModuleFilenameHelpers.createFilename = function createFilename(module, moduleFil
shortIdentifier = module.readableIdentifier(requestShortener);
identifier = requestShortener.shorten(module.identifier());
moduleId = module.id;
absoluteResourcePath = module.resourcePath || module.identifier().split("!").pop();
absoluteResourcePath = module.identifier().split("!").pop();
hash = getHash(identifier);
}
const resource = shortIdentifier.split("!").pop();

View File

@ -20,11 +20,6 @@ class SourceMapDevToolPlugin {
constructor(options) {
if(arguments.length > 1)
throw new Error("SourceMapDevToolPlugin only takes one argument (pass an options object)");
if(typeof options === "string") {
options = {
sourceMapFilename: options
};
}
if(!options) options = {};
this.sourceMapFilename = options.filename;
this.sourceMappingURLComment = options.append === false ? false : options.append || "\n//# sourceMappingURL=[url]";

View File

@ -299,9 +299,7 @@ class Stats {
type: reason.dependency.type,
userRequest: reason.dependency.userRequest
};
const dep = reason.dependency;
if(dep.templateModules) obj.templateModules = dep.templateModules.map(module => module.id);
const locInfo = formatLocation(dep.loc);
const locInfo = formatLocation(reason.dependency.loc);
if(locInfo) obj.loc = locInfo;
return obj;
}).sort((a, b) => a.moduleId - b.moduleId);
@ -643,7 +641,6 @@ class Stats {
colors.normal(reason.type);
colors.normal(" ");
colors.cyan(reason.userRequest);
if(reason.templateModules) colors.cyan(reason.templateModules.join(" "));
colors.normal(" [");
colors.normal(reason.moduleId);
colors.normal("] ");

View File

@ -81,7 +81,7 @@ class WebpackOptionsApply extends OptionsApply {
let WebWorkerTemplatePlugin = require("./webworker/WebWorkerTemplatePlugin");
NodeSourcePlugin = require("./node/NodeSourcePlugin");
compiler.apply(
new WebWorkerTemplatePlugin(options.output),
new WebWorkerTemplatePlugin(),
new FunctionModulePlugin(options.output),
new NodeSourcePlugin(options.node),
new LoaderTargetPlugin("webworker")