Keep using module.useNode() instead of bundling server node_modules.

This partially reverts commit 4dfc74197a.

Some server packages, especially those that rely on __dirname or
__filename (e.g. puppeteer), simply cannot be included in the server
bundle, and must be evaluated natively by Node.

As long as we have a Module.prototype._compile hook to process natively
evaluated modules with Reify, module.useNode() can still benefit from ESM
import/export syntax.
This commit is contained in:
Ben Newman
2019-07-02 13:11:11 -04:00
parent 0c5cb13136
commit 8ef0326380

View File

@@ -1222,17 +1222,6 @@ export default class ImportScanner {
return false;
}
if (
absModuleId.endsWith(".js") ||
absModuleId.endsWith(".mjs")
) {
return false;
}
if (absModuleId.endsWith(".node")) {
return true;
}
const parts = absModuleId.split("/");
let start = 0;