mirror of https://github.com/webpack/webpack.git
refactor: dead code elimination
remove those code not defined but used; remove unused code
This commit is contained in:
parent
59e5de59d7
commit
52055ba07e
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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]";
|
||||
|
|
|
|||
|
|
@ -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("] ");
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in New Issue