如何在JavaScript程序中配置IntelliJ来解决〜 [英] How to configure IntelliJ to resolve ~ in JavaScript programs

查看:159
本文介绍了如何在JavaScript程序中配置IntelliJ来解决〜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个现有的代码库,其中JavaScript导入的编写如下:

I'm working on an existing codebase where the JavaScript imports are written like this:

从'〜/ dir1导入{somethingToImport} / dir2 / fileName'

哪个解析(通过webpack)到

Which resolves (via webpack) to

$ {project_root} / src / dir1 / dir2 / fileName

我知道使用相对路径导入更标准在JavaScript中,但我不能改变整个代码库。所以我想知道如何配置IntelliJ(或WebStorm)来解决导入 - 让我点击并正常查找用法。

I know that it's more standard to use relative path imports in JavaScript, but I can't change the entire codebase. So I'm wondering how to configure IntelliJ (or WebStorm) to resolve the import - letting me click through and "find usages" normally.

推荐答案

特定于Webpack的模块解析( resolve.moduleDirectories resolve.root 目前不支持resolve.alias 等)。请关注 WEB-13409 并链接更新门票

Webpack-specific modules resolving (resolve.moduleDirectories, resolve.root, resolve.alias, etc.) is not currently supported. Please follow WEB-13409 and linked tickets for updates

这篇关于如何在JavaScript程序中配置IntelliJ来解决〜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆