Joseph Michael Pesch
VP Programming

Angular 2 Compile Warning "Critical dependency: the request of a dependency is an expression"

by 28. February 2018 15:11

When compiling Angular 2 application I received compile warning "Critical dependency: the request of a dependency is an expression" when using the require() method with a variable vs. literal string value (see examples below).

 

This throws compile warning:

let path = 'path_to_item';

let item = require(path);

 

This does not throw compile warning:

let item = require('path_to_item');

 

Tags:

Angular

Comments are closed