我正在我的 angular
应用中使用一个服务来创建 uibModal
,如下所示
function modal(modalConfig){
var modalInstance = $uibModal.open({
animation: true,
template: require("../a/b/xyz.html"),
controller: modalConfig.controller,
size: modalConfig.size,
controllerAs: modalConfig.controllerAs,
bindToController : true,
resolve: modalConfig.resolveObj
});
}
请注意这行文字
template: require("../a/b/xyz.html"),
我想要像这样使用一个变量来代替它的位置
template: require(modalConfig.templateUrl),
但当我使用一个变量来代替硬编码的值时,webpack
会给我
Critical dependencies:
83:22-54 the request of a dependency is an expression
我无法解决这个错误。可能的原因是什么?
我已经使用了node-express
服务器进行连续的webpack
构建。我也看过其他答案,但它们没有解决我的问题。