-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
safe mode behaves strangely when using with webpack #137
Comments
I have the same issue. |
|
Any solution yet? |
setTheme simply shouldn't be using a dynamic require. There is literally no reason to allow object definitions and file paths in this API. Not only is it problematic in the case of webpack, but its confusing since require can use colors/lib as the root for searching for the theme. If the user wants to store a theme in a file, why not let them simply do this?
It makes much more sense. |
Then again, since this is a command prompt console library, a fair question is why are you using this module in browsers with webpack? |
@fresheneesz I'm working on a CLI project. The CLI use webpack to bundle another project, and I need to log some information with pretty colors. |
@gocreating because colors in a browser console is also useful. |
Having the same issues. |
+1 |
+1. Pls, tell me some solution |
+1 |
I was able to suppress the message by using this in webpack: module: {
exprContextCritical: false,
} |
@OmarElabd That's a bad idea. Critical contexts mean that an unpredicatable number of extra files are being pulled into your project which will bloat your bundle. |
@fresheneesz I use webpack to bundle my project to deploy it on AWS Lambda. |
+1 same issue when use webpack |
+1 Same here |
@Marak Could you please respond? Do you have the intention of maintaining this project or not? If not, please consider adding contributors or transferring the ownership. |
I understand dynamic require isn't best use-case. In most use-cases this block of code isn't being called at all. I'm glad to see this issue fixed, but don't see one person here who took the time to make pull request or fork project with a fix. I never tried to use webpack or browserify on I am individually responsible for a mountain of open-source software across multiple platforms and at this point, If not, I'll do my best to try and push out a new version of |
I really appreciate your response and understand maintaining open source projects can be very time consuming; and adding contributors, or let alone transferring ownership of a project with large number of users isn't something easy. With that being said, the problematic part mentioned in this issue can be factored out so that importing the theme is the responsibility of the user, as per @fresheneesz's suggestion. Would you be happy to consider a pull request for that change? |
Dear @Marak, I've provided a PR for your review. I do hope you're able to consider it for merge as I'm also having a similar webpack warning being issued for my Electron app. In my case, I am using winston for logging which pulls in your project as a dependency. The warnings emitted from webpack are a double whammy: on the webpack console and in the Electron renderer instance HMR log. The latter is particularly distracting. |
Thanks for the PR, I'm going to give it a thorough review. Have to be careful about backwards compatibility etc., but this is a significant enough problem that we might just incorporate this and tag a new major release. |
Please make sure that basic |
@Marak I don't believe it is possible to fix it in a backward compatible way, if people don't care about depending on the correct version of a package, is it right to stop progress for them? |
@DABH thanks for taking assignment and review of my PR. As it been sitting idle for nearly five months, and this issue existing way back to 2015, I will make sure to be responsive to your comments so we can finally bring it to a close. |
Sure thing. I promised Marak to not break anything, so my number one priority is to tread extremely carefully and test extremely thoroughly before doing anything. I'll try to make a small roadmap doc (if I manage to be so organized), but after some initial issue/PR triaging, it seems like there are:
In either case, releases will be managed with great care -- e.g. we will do RC releases before publishing any final builds, etc. Thanks for your responsiveness -- I will try to return the favor! Don't expect too much, but as a first guess, I'll attempt to have a review done on this within a week or two. Feel free to bother me until we reach a conclusion :) FWIW I don't think this issue is part of the core API, and the "bad" overload of this function feels like an anti-pattern anyway, so I think we will be able to find a positive resolution here... but stay tuned... :) |
@DABH Thanks for taking this on. |
Please check out |
My webpack log keeps showing warning message even when I use the safe mode
var colors = require('colors/safe');
The warning message is
I am not sure whether this problem belongs to
webpack
orcolors
...The text was updated successfully, but these errors were encountered: