相关疑难解决方法(0)

让VS代码读取webpack.config并使用别名识别路径?

我正在使用Webpack和Visual Studio Code,以避免以下情况:

import { AuthenticationService } from '../../../services/authentication/service';
Run Code Online (Sandbox Code Playgroud)

我在webpack.config上创建了别名,所以我可以使用:

import { AuthenticationService } from 'services/authentication/service';
Run Code Online (Sandbox Code Playgroud)

但是,通过这样做,Visual Code无法检测到我的代码,因此我失去了我的类的智能感知.

有没有人有解决方案,有没有办法让VS代码读取webpack.config并识别带别名的路径?

提前致谢

webpack visual-studio-code

39
推荐指数
4
解决办法
1万
查看次数

Visual Studio 2019 将不会使用 webpack-source 构建 TypeScript

我的问题似乎是 Visual Studio 正在尝试导入不应该导入的模块。这是我收到的错误。我正在尝试使用 Visual Studio 设置 Webpack。webpack 构建工作正常。Visual Studio TypeScript 构建失败。

Severity    Code    Description Project File    Line    Suppression State
Error   TS2792  Build:Cannot find module '.'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? Nester.MvcUI    C:\...\MvcUI\node_modules\@types\webpack-sources\lib\CachedSource.d.ts  3   
Error   TS2792  Build:Cannot find module '.'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? Nester.MvcUI    C:\...\MvcUI\node_modules\@types\webpack-sources\lib\CompatSource.d.ts  1   
Error   TS2792  Build:Cannot find module '.'. …
Run Code Online (Sandbox Code Playgroud)

javascript typescript webpack asp.net-core visual-studio-2019

5
推荐指数
0
解决办法
1400
查看次数