have to modify util path because it was trying to ref my util folder
chrisnorristech opened this issue ยท 10 comments
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch assert@2.0.0 for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/assert/build/assert.js b/node_modules/assert/build/assert.js
index a4bc0a8..69d87ed 100644
--- a/node_modules/assert/build/assert.js
+++ b/node_modules/assert/build/assert.js
@@ -35,10 +35,10 @@ var _require = require('./internal/errors'),
var AssertionError = require('./internal/assert/assertion_error');
-var _require2 = require('util/'),
+var _require2 = require('../../util/'),
inspect = _require2.inspect;
-var _require$types = require('util/').types,
+var _require$types = require('../../util/').types,
isPromise = _require$types.isPromise,
isRegExp = _require$types.isRegExp;
diff --git a/node_modules/assert/build/internal/assert/assertion_error.js b/node_modules/assert/build/internal/assert/assertion_error.js
index 9295f0a..df8c0b9 100644
--- a/node_modules/assert/build/internal/assert/assertion_error.js
+++ b/node_modules/assert/build/internal/assert/assertion_error.js
@@ -32,7 +32,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
-var _require = require('util/'),
+var _require = require('../../../../util/'),
inspect = _require.inspect;
var _require2 = require('../errors'),
diff --git a/node_modules/assert/build/internal/errors.js b/node_modules/assert/build/internal/errors.js
index 3f4350a..b9d7729 100644
--- a/node_modules/assert/build/internal/errors.js
+++ b/node_modules/assert/build/internal/errors.js
@@ -142,7 +142,7 @@ createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
}, TypeError);
createErrorType('ERR_INVALID_ARG_VALUE', function (name, value) {
var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid';
- if (util === undefined) util = require('util/');
+ if (util === undefined) util = require('../../../util/');
var inspected = util.inspect(value);
if (inspected.length > 128) {
diff --git a/node_modules/assert/build/internal/util/comparisons.js b/node_modules/assert/build/internal/util/comparisons.js
index 31d43ff..e1f4ad3 100644
--- a/node_modules/assert/build/internal/util/comparisons.js
+++ b/node_modules/assert/build/internal/util/comparisons.js
@@ -44,7 +44,7 @@ var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);
var objectToString = uncurryThis(Object.prototype.toString);
-var _require$types = require('util/').types,
+var _require$types = require('../../../../util/').types,
isAnyArrayBuffer = _require$types.isAnyArrayBuffer,
isArrayBufferView = _require$types.isArrayBufferView,
isDate = _require$types.isDate,This issue body was partially generated by patch-package.
You shouldn't need all those ../ at all - can you elaborate on what led you to think you do?
That sounds like an expo bug, perhaps? (with bare specifier package names with a trailing slash, perhaps?)
util/ is a bare specifier, and should always grab the closest node_modules/util/ package.
It'd be great if you filed that issue with them (assuming renaming your "util" to something else fixes the problem), since "needing to patch a package" is a very dangerous situation for any project to be in.
do i just close this issue?
Sure, let's do that :-) but i'd still request you file an issue with expo so they can fix the bug.
Locate their repo, and do what you did here :-) I don't use expo myself, so I'm not sure which repo would be appropriate.