question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to deal with webpack warning from unmaintained grandparent module?

See original GitHub issue

Can you reproduce the problem with latest npm?

yes.

Description

Requiring winston generates a warning due to some webpack-warning-deserving code that winston’s dependency, colors has.

It’s currently impossible AFAICT to tell eslint to ignore it.

I’m opening this bug here because it’s impossible to e.g. disable the webpack warning exprContextCritical without ejecting, but using a very popular logging module shouldn’t require ejecting.

Alternatively, can anyone suggest an alternative to winston?

Related issues:

Expected behavior

Adding winston to a CRA project should not add warnings on each page load, or it should be possible to deal with a “misbehaving” grandparent.

Actual behavior

import log from "winston";
log.info('hi there')

yields:

Compiled with warnings.

Warning in ./~/colors/lib/colors.js
Critical dependencies:
127:29-43 the request of a dependency is an expression
 @ ./~/colors/lib/colors.js 127:29-43

Warning in ./~/colors/lib/extendStringPrototype.js
Critical dependencies:
106:31-45 the request of a dependency is an expression
 @ ./~/colors/lib/extendStringPrototype.js 106:31-45

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

Environment

  1. npm ls react-scripts (if you haven’t ejected):
webpack-warning@0.1.0 /Users/da/src/webpack-warning
└── react-scripts@0.9.5 
  1. node -v: v7.7.2
  2. npm -v: 4.4.4

Then, specify:

  1. Operating system: OSX 10.12.4
  2. Browser and version: Chrome 56.0.2924.87

Reproducible Demo

See minimal repo at https://github.com/davidascher/webpack-warning/

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
gaearoncommented, Apr 2, 2017

Longer term we aim to solve it here: https://github.com/webpack/webpack/issues/4263

2reactions
Timercommented, Apr 2, 2017

I suggest forking colors, removing the dynamic require (or putting it behind a nodejs/webpack&browserify compatible escape hatch to make it web bundle friendly), and releasing a semver-major (2.0). You can then submit a follow up PR to winston switching to the new module.

Unfortunately we’re not going to add an escape hatch for this, so you will need to eject or live with the warning. Our philosophy is to require no configuration and avoid introducing it where otherwise unnecessary. Adding an escape hatch to bundle improper web packages is one we’re definitely not going to support (sorry!).


You can check out bunyan, too.

Let me know if we can help with anything else. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack warning - There is another module with an equal ...
I'm facing a similar problem where it's showing a relative path for the first warning and an absolute path for the second. WARNING...
Read more >
I've Just Liberated My Modules - Hacker News
The author unpublished (erm, "liberated") over 250 NPM modules, ... It's already being used to manage dependencies on the go-ipfs project: ...
Read more >
3 warnings in child compilations (use 'stats.children: true' resp. '
Working in Vue to build a JavaScript application (Mathificent) , I get the following error; ERROR in Error: Child compilation failed: Module build...
Read more >
Welcome to Everything.js | Everything.js
webpack /webpack - A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts...
Read more >
yzO - ALBA.Net
Roland td-5 sound module, Type 2 lfsr, Chicago bears sideline cape, Anthony phoya, ... Ed edmodo, Dealing with bigots in the family, Emilija...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found