【发布时间】:2023-04-09 17:34:01
【问题描述】:
所以我的 AngularJS 代码如下所示:
define(['angular', 'text!./template.html'], function (angular, template) {
'use strict';
return angular.module('app.widget', [])
.directive('MyWidget', function(){
//.... use the template here
})
我正在使用 RequireJS 的文本插件来获取 html 模板并在 AngularJS 指令中使用。 我想使用 webpack,它可以读取 AMD 样式代码,但它不能与文本插件一起使用。
有谁知道如何让 webpack 的文本加载器与 requirejs 一起工作? 有some solutions out there 和discussion thread,但我无法让它们工作。
在我的 webpack.config.js 我有
loaders: [
{ test: /^text\!/, loader: "text" }
]
谢谢
【问题讨论】:
标签: angularjs requirejs webpack