Solve bugs from node port.
@@ -214,23 +214,6 @@ mod.prototype.require = function (name) {
// /* Continue loading */
// }
- /* Try to load it with NodeJS first */
- try {
- return node_require.apply(this, [ name ]);
- } catch (e) {
- if (e.code !== 'MODULE_NOT_FOUND') {
- throw e;
- }
- }
-
- try {
- return node_require.apply(this, [ require.resolve(name) ]);
- } catch (e) {
- if (e.code !== 'MODULE_NOT_FOUND') {
- throw e;
- }
- }
-
const index = name.lastIndexOf('.');
if (index !== -1) {
@@ -244,6 +227,14 @@ mod.prototype.require = function (name) {
}
}
+ try {
+ return node_require.apply(this, [ name ]);
+ } catch (e) {
+ if (e.code !== 'MODULE_NOT_FOUND') {
+ throw e;
+ }
+ }
+
/* If there is no extension or the extension is not supported or it is 'node', load it with NodeJS require */
try {
const filename = require.resolve(name);
