favware / skip-dependency

Skip pesky NodeJS dependencies with ease
MIT License
20 stars 5 forks source link

Remove console.log statement #1

Closed abrkn closed 3 years ago

abrkn commented 3 years ago

It's not helpful

favna commented 3 years ago

If you somehow actually run into the console.log in your code then you're using the dependency wrong. So there's no harm for the small Easter egg to be there.

Please give me an example where you ran into the console log.

jorissteyn commented 3 years ago

This happens build-time, I don't think I'm using it wrong - it works fine but the message will show during build:

image

favna commented 3 years ago

This means that whatever dependency you're ignoring is still being accessed and the index.js file is being executed. I'll remove the line but I would advise you to look into the webpack output as it may be invalid in one way or another due to skip-dependency being accessed instead of the dependency it would otherwise access.

favna commented 3 years ago

Version 1.1.0 has been published which removes the line. Update the version in the resolutions string to the following to start using it.

https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.0.tgz
jorissteyn commented 3 years ago

This means that whatever dependency you're ignoring is still being accessed and the index.js file is being executed.

I believe you're right and think I understand why we're seeing the message. I'm using this package (as others do too) to build image-webpack-loader without gifsicle. It will import the module, but not use it since it's excluded in the webpack config.

Thanks for the fast response!

jorissteyn commented 3 years ago

Hm, there is a, perhaps unintended, difference between the two versions:

1.1.0 image

1.0.2 image

Version 1.0.2 works fine, 1.1.0 does not (can't find module ...). This is how I include the package in package.json (the addition works, the removal doesn't):

     "throttled-resize": "^1.0.1"
   },
   "resolutions": {
-    "gifsicle": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.0.tgz"
+    "gifsicle": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.0.2.tgz"
   }
 }
favna commented 3 years ago

And here I was hoping I could improve the package a bit... I'll have to look into this then. Is this repo where you're using gifsicle open source so I can use it to test @jorissteyn ?

jorissteyn commented 3 years ago

Yeah see the comment in https://github.com/Klathmon/imagemin-webpack-plugin/issues/113

favna commented 3 years ago

@jorissteyn I tried to reproduce it but I couldn't get to give me any error. That said, I did publish v1.1.1 where I moved the index files out of src again. Could you check that version, and if it doesn't work, could you create a small repo with the issue so I can use that to fix the issue?

jorissteyn commented 3 years ago

Confirmed v1.1.1 works like a charm, thank you!

favna commented 3 years ago

That's good to hear, then I'll close this issue.