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.

"Critical dependency: the request of a dependency is an expression" with webpack, Babel & TypeScript

See original GitHub issue

Describe the bug I am using a TypeScript setup with webpack and babel and get the following warnings when including elastic-apm-node.

WARNING in node_modules/elastic-apm-node/lib/agent.js 152:16-59
Critical dependency: the request of a dependency is an expression
 @ node_modules/elastic-apm-node/index.js

WARNING in node_modules/elastic-apm-node/lib/config.js 25:19-36
Critical dependency: the request of a dependency is an expression
 @ node_modules/elastic-apm-node/lib/agent.js

WARNING in node_modules/elastic-apm-node/lib/instrumentation/index.js 169:16-30
Critical dependency: the request of a dependency is an expression
 @ node_modules/elastic-apm-node/lib/agent.js

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/arichter83/meteor-webpack/tree/with-elastic-apm-node
  2. Run npm install
  3. Run npm start

How are you starting the agent? (please tick one of the boxes)

  • Requiring elastic-apm-node/start from within the source code

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
havrancommented, Oct 29, 2020

By use @angular-builders/custom-webpack and add custom webpack configuration, second part problems with errors solved:

const webpack = require('webpack');

module.exports = {
  resolve: {
    extensions: ['.json'],
  }
};

Now dev:ssr and build:ssr compile successfully.

0reactions
gtorrecommented, Dec 9, 2021

Big thanks to @havran your work around fixed the problem I was having!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bundling typescript using webpack: the request of a ... - GitHub
node_modules/typescript/lib/typescript.js Critical dependency: the request of a dependency is an expression .
Read more >
Webpack - Critical dependency: the request of a dependency ...
Webpack tries to resolve require calls statically to make a minimal bundle. When a library uses variables or expressions in a require call...
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 >
TypeScript - webpack
In this guide we will learn how to integrate TypeScript with webpack. Basic Setup. First install the TypeScript compiler and loader by running:...
Read more >
ts-loader - npm
This is the TypeScript loader for webpack. ... from static type checking between different dependencies in your application will be lost.
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