mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1403106 - Fix rewrite-lazy require for non-named modules; r=Honza
MozReview-Commit-ID: 3vGooT3G450 --HG-- extra : rebase_source : 60d9dc3223e3c3ae0ff72e6685ae8950eda5451f
This commit is contained in:
parent
730fb6c537
commit
e2539fb394
@ -7,8 +7,14 @@
|
||||
module.exports = function (content) {
|
||||
this.cacheable && this.cacheable();
|
||||
|
||||
return content.replace(
|
||||
// taking care of "named" depedencies.
|
||||
let res = content.replace(
|
||||
/loader.lazyRequireGetter\(this,\s*"([^"]+)",[^"]*"([^"]+)", true\);/g,
|
||||
"let { $1 } = require(\"$2\")"
|
||||
);
|
||||
// And then of direct ones.
|
||||
return res.replace(
|
||||
/loader.lazyRequireGetter\(this,\s*"([^"]+)",[^"]*"([^"]+)"(, false)?\);/g,
|
||||
"let $1 = require(\"$2\")"
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user