简体   繁体   English

WebStorm将解决“。” 到'./index.js'而不是'./'

[英]WebStorm will resolve '.' to './index.js' but not './'

I've recently switched to WebStorm 2017.3 from another editor, it's pretty decent with the exception of a few teething problems that I've managed to sort, all with the exception of one. 我最近从另一个编辑器切换到了WebStorm 2017.3,它非常不错,除了我设法解决的一些棘手问题之外,除了一个问题。

When I go to import a component into a file using './' (a test file in this case) in the same directory, throws me a yellow squiggly. 当我使用同一目录中的'./' (在这种情况下为测试文件)将组件导入文件时,使我感到困惑。 If I use '.' 如果我使用'.' then everything is all good in the hood. 那么一切都好在引擎盖上。 I'm on a legacy codebase so I can't change all the imports to this. 我使用的是旧版代码库,因此无法将所有导入内容都更改为此。

import GroupFooter from './' // throws me an error.
import GroupFooter from '.' // is all good.

I've tried switching the 'use directory import when index.js is available' but still no joy. 我尝试过切换“在index.js可用时使用目录导入”,但仍然没有任何乐趣。 Does anybody have any ideas as to how to get WebStorm to recognise './' as a viable path? 是否有人对如何使WebStorm识别'./'作为可行路径有任何想法? *It should be noted that webpack has no trouble resolving this, nor does the test runner that runs the file. *应注意,webpack可以解决该问题,运行该文件的测试运行程序也没有问题。

在此处输入图片说明

Looks similar to WEB-30209 that is fixed in most recent update. 外观类似于最新更新中已修复的WEB-30209 Please try upgrading Webstorm 请尝试升级Webstorm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM