【发布时间】:2016-08-28 06:30:00
【问题描述】:
我在我的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 构建。我也看过其他答案,但他们没有解决我的问题。
【问题讨论】: