我已经尝试通过将此添加到webpack / loaders目录来设置webpack加载器
var path = require('path');
module.exports = {
test: /\.html$/,
loaders: [`ngtemplate?relativeTo=${path.join(__dirname, "/app")}`, "html"] //html?attrs[]=div:ng-include
}
然后从.js代码中要求相应的模板文件。
templateUrl: require('ngtemplate!html!./app/views/environment/index.html')
但是我收到以下错误
Module not found: Error: Can't resolve 'html' in '/Users/joe/testrails5.1/app/javascript/app/scripts'
resolve 'html' in '/Users/joe/testrails5.1/app/javascript/app/scripts'
Parsed request is a module
这对其他人有用吗?我使用角度1.6,所以我需要使用不同的模块吗?