【发布时间】:2017-12-06 22:53:42
【问题描述】:
我正在尝试将 ngtemplate-loader 配置为能够在 TypeScript 文件中使用我的角度模板,如下所示:
import myTemplateUrl from './hello-angular2-template.thtml';
angular
.module('pd')
.component('helloAngular2', {
templateUrl: myTemplateUrl,
});
webpack.config 中的加载器定义:
module: {
rules: [
// Angular Template HTML
{
test: /\.thtml$/,
use: [
{
loader: 'ngtemplate-loader',
},
{
loader: 'html-loader',
}
],
},
(奇怪的 *.ththml 后缀就是这样,没有标准的 html-loader 可以干扰。)
但是模板永远不会被加载(导入后未定义)。
我尝试添加
options: {
exportAsEs6Default: true
}
到链接的 html-loader,但这也没有成功。
【问题讨论】: