[英]How to import html file as template in typescript vue js project as module to use same html file in more than a component?
我正在尝试将外部 html 文件加载到 typescript 语言的 Vuejs 项目中,但 typescript 编译器给我的问题如下
ERROR Failed to compile with 1 errors 3:51:57 PM
error in ./src/components/common/dynamic-render.html
我没有 webpack.config.js 因为这个项目是通过 vue-cli 生成的
我试图在vue-template-loader ts-loader
的帮助下加载文件,但编译器仍然抛出同样的问题
仪表板.vue
import WithRender from "./common/dynamic-render.html";
@WithRender
@Component
我得到以下错误
ERROR Failed to compile with 1 errors 3:51:57 PM
error in ./src/components/common/dynamic-render.html
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
您是否按照本文中的说明定义了shims-html.d.ts
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.