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.

Webpak - Critical dependency: the request of a dependency is an expression

See original GitHub issue

Hi! I want to bundle postcss-cssnext package with Webpack for a web app and browserslist is also included. I’m following the information mentioned in README.md to remove locales (new webpack.IgnorePlugin(/caniuse-lite\/data\/regions/)) but have a doubt on something else.

There’s a scary warning when bundling with Webpack: Critical dependency: the request of a dependency is an expression on this line. According to Webpack docs, full dynamic requires fail by default.

They mention that ContextReplacementPlugin can be used in this situation but I don’t really know what is the actual context and where to redirect it. Any idea on how to fix this?

Thanks!

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
frandioxcommented, Dec 7, 2017

@ai Thanks for answering! Looks like resolve.dynamic: false is not a valid option at least in webpack@3.10.0. The following suppresses the warning but I’m not sure if it’s reliable:

module: {
  exprContextRegExp: /$^/,
  exprContextCritical: false,
}

According to the docs, these props are deprecated and ContextReplacementPlugin should be used instead. However, I couldn’t stop the warning with that plugin… 😕

2reactions
aicommented, Jan 15, 2018

Released in 2.11.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack - Critical dependency: the request of a dependency ...
Webpack - Critical dependency: the request of a dependency is an expression · Manually configure webpack to import the required libraries and ...
Read more >
Webpack Warning: Critical dependency: the request of a ...
When looking at webpack/webpack#196 this seems to be a webpack warning about a require statement using a dynamic path for loading, as this...
Read more >
the request of a dependency is an expression webpack - You ...
When a library uses variables or expressions in a require call (such as require ('' + 'nodent') in these lines of ajv ),...
Read more >
Webpack - the request of a dependency is an expression
Webpack – Critical dependency: the request of a dependency is an expression · Manually configure webpack to import the required libraries and prevent...
Read more >
Integration with WebPack - Linkurious documentation
Critical dependency: the request of a dependency is an expression. This warning is due to a line in Ogma that attempts to require...
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