common-shakeify icon indicating copy to clipboard operation
common-shakeify copied to clipboard

Verbose mode throws an error when --full-paths flag is not used

Open jeremija opened this issue 4 years ago • 0 comments

In verbose mode, the call to path.relative throws an error when --full-paths flag is not used. This is because the module name will be a number.

https://github.com/browserify/common-shakeify/blob/master/index.js#L30

Example:

$ browserify -g [ loose-envify purge --NODE_ENV production ] -p [ esmify ] -p [ common-shakeify -v ] -t babelify ./lib/index.js -o ./build/index.prod.js

internal/validators.js:112
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "to" argument must be of type string. Received type number
    at validateString (internal/validators.js:112:11)
    at Object.relative (path.js:1054:5)
    at /node_modules/common-shakeify/index.js:33:83
    at Array.forEach (<anonymous>)
    at Object.onModuleBailout (/node_modules/common-shakeify/index.js:28:17)
    at /node_modules/common-shakeify/index.js:152:14
    at Map.forEach (<anonymous>)
    at DestroyableTransform.onend [as _flush] (/node_modules/common-shakeify/index.js:140:22)
    at DestroyableTransform.prefinish (/node_modules/readable-stream/lib/_stream_transform.js:138:10)
    at DestroyableTransform.emit (events.js:223:5) {

jeremija avatar May 03 '20 06:05 jeremija