Skip to content

Commit

Permalink
refactor(seajs): res use const instead of let
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyoukun committed Jun 28, 2018
1 parent c814f83 commit ff76178
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions bin/tsw/loader/seajs/lib/sea-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@ const moduleStack = [];


Module._resolveFilename = function(request, parent, isMain, options = {}) {
let res;
//request = request.replace(/\?.*$/, '') // remove timestamp etc.
// request = request.replace(/\?.*$/, '') // remove timestamp etc.

//性能优化
// 性能优化
// do not use cache when `options` has `paths` property
// in v8.9.0 require.resolve case
if(parent.resolveFilenameCache && !options.paths) {
if(parent.resolveFilenameCache[request]) {
if (parent.resolveFilenameCache && !options.paths) {
if (parent.resolveFilenameCache[request]) {
return parent.resolveFilenameCache[request];
}
}else{
} else {
parent.resolveFilenameCache = {};
}

res = _resolveFilename(request, parent, isMain, options);
const res = _resolveFilename(request, parent, isMain, options);

parent.resolveFilenameCache[request] = res;

Expand Down

0 comments on commit ff76178

Please sign in to comment.