【发布时间】:2016-10-28 21:07:39
【问题描述】:
我正在使用 Webpack 和 Visual Studio Code,以避免出现以下情况:
import { AuthenticationService } from '../../../services/authentication/service';
我已经在我的 webpack.config 上创建了别名,所以我可以使用:
import { AuthenticationService } from 'services/authentication/service';
但是,通过这样做,Visual Code 无法检测到我的代码,因此我失去了类的智能感知。
有没有人对此有解决方案,有没有办法让 VS 代码读取 webpack.config 并识别带有别名的路径?
提前致谢
【问题讨论】:
-
我确实有 VSCode (1.3.1) 在 js 文件中识别 webpack 的别名。别名在打字稿中不起作用。你说的是 javascript 还是 typescript?
-
是的,我正在使用打字稿。
标签: webpack visual-studio-code