Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

typescript的引入.ts文件遇到的问题

项目是ts和js混用的
tsx文件导入ts文件webpack打包错误(happypack的ts_loader)找不到.js文件
深度截图_选择区域_20200512162747.png
在路径上加上.ts后缀,webpack可以打包成功但是vsCode有报错
深度截图_选择区域_20200512162557.png
我想问一下有没有好的解决方案:

  1. 让vscode不报错,
  2. 或者webpack在tsx文件里默认加载.ts,在js文件里默认加载.js

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

webpack 配置下 extensions 就好了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...