在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML/ vue+typescript創(chuàng)建項(xiàng)目是,提示找不到.html文件

vue+typescript創(chuàng)建項(xiàng)目是,提示找不到.html文件

之前用"vue-html-loader": "^1.0.0", vue+js+webpack
將.vue文件拆成(.html+.css+.js)進(jìn)行開(kāi)發(fā)。進(jìn)入。html文件沒(méi)問(wèn)題。

最近打算嘗試ts.發(fā)現(xiàn)提示找不到
package.json:

"devDependencies": {
//...
"vue-html-loader": "^1.0.0",
}

[ts] 找不到模塊“./demo-list.html”。

clipboard.png

These relative modules were not found:

* ./vue2.html in ./fui-app/view/vue2/vue2.ts
* ./pwa.html in ./fui-app/view/pwa/pwa.ts
* ./index.html in ./fui-app/view/fui/index.ts
* ./main.html in ./src/directives/directives/vtip/main/main.ts, ./src/directives/directives/tooltip/main/main.ts
* ./scroll-menus.html in ./src/fui-components/components/scroll-menus/src/scroll-menus.ts
* ./all-menus.html in ./src/fui-components/components/all-menus/src/all-menus.ts
* ./search.html in ./fui-app/view/search/search.ts
* ./demo-list.html in ./fui-app/view/fui/demo-list/demo-list.ts
回答
編輯回答
薔薇花
import tpl from 'XXX.yy'

這種寫(xiě)法必須得是目標(biāo)文件里面有module拋出(export),沒(méi)有就

import 'XXX.yy'

vue-html-loader我沒(méi)用過(guò),之前用過(guò)類(lèi)似的html-loader,引入方法是直接在頁(yè)面對(duì)應(yīng)位置require目標(biāo)文件。
根據(jù)我從npm查看的vue-html-loader官方文檔,也是我說(shuō)的用法

2018年6月1日 15:44
編輯回答
擱淺

恕我無(wú)知,html文件可以import引入?

2018年5月22日 11:03
編輯回答
奧特蛋

添加一個(gè)全局的*.d.ts 內(nèi)容為

declare module "*.html" {
  const content: string
  export default content;
}

然后重啟服務(wù)

2018年5月8日 19:09
編輯回答
扯機(jī)薄

路徑問(wèn)題把 把./去掉

2018年4月17日 11:14