mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Revert "Don't scan require calls in Browserify/Webpack bundles."
This reverts commit 99cb96fcf7.
Webpack already avoids this problem by transforming `require` to
`__webpack_require__`, and Browserify bundles can use something like
https://www.npmjs.com/package/derequire to rewrite ``require` calls to
avoid confusing other tools. False positives are acceptable, and we can
measure/mitigate the performance consequences in any number of ways.
Fixes #6427.
Fixes #6430.
This commit is contained in:
@@ -83,10 +83,6 @@ export function findImportedModuleIdentifiers(source, hash) {
|
||||
while (left < right && end < possibleIndexes[right - 1]) --right;
|
||||
|
||||
if (left < right) {
|
||||
if (isFunctionWithParameter(node, "require")) {
|
||||
return;
|
||||
}
|
||||
|
||||
let id = getRequiredModuleId(node);
|
||||
if (typeof id === "string") {
|
||||
identifiers[id] = node;
|
||||
@@ -129,18 +125,6 @@ function isNode(value) {
|
||||
&& typeof value.end === "number";
|
||||
}
|
||||
|
||||
function isFunctionWithParameter(node, name) {
|
||||
if (node.type === "FunctionExpression" ||
|
||||
node.type === "FunctionDeclaration" ||
|
||||
node.type === "ArrowFunctionExpression") {
|
||||
return node.params.some(
|
||||
param =>
|
||||
param.type === "Identifier" &&
|
||||
param.name === name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function getRequiredModuleId(node) {
|
||||
if (node.type === "CallExpression" &&
|
||||
node.callee.type === "Identifier" &&
|
||||
|
||||
Reference in New Issue
Block a user