我正在尝试为与 Vite 捆绑的 React 应用程序设置路径别名tsconfig.json。这是我的相关部分tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
...
"paths": {
"*": ["src/*", "node_modules/*"],
"components/*": ["src/components/*"],
"containers/*": ["src/containers/*"],
"pages/*": ["src/constants/*"],
"store/*": ["src/store/*"],
"types/*": ["src/types/*"],
"NestedFolder/*": [
"src/components/NestedFolder/*"
],
}
},
"include": ["src/**/*", "*"]
}
Run Code Online (Sandbox Code Playgroud)
唯一的问题是NestedFolder. 当我以这种方式导入时,一切正常:
import { ComponentName } from "components/NestedFolder/types";
Run Code Online (Sandbox Code Playgroud)
但是,嵌套别名失败:
import { ComponentName } from "NestedFolder/types";
// error
EslintPluginImportResolveError: typescript with invalid interface loaded as resolver
Occurred while linting .../src/components/NestedFolder/canvas/index.ts:1
Rule: "import/namespace"
// error on hover in VS Code …Run Code Online (Sandbox Code Playgroud) 我已经在 Jekyll 网站上工作了一个月,没有出现任何问题,但从本周开始,每次我尝试运行时都会bundle install收到错误Bundler::HTTPError Could not fetch specs from https://rubygems.org。我使用的是 macOS 10.13,ruby 2.5.1。
这是我的输出ruby -ropen-uri -e \'eval open("https://git.io/vQhWq").read\'
Here\'s your Ruby and OpenSSL environment:\n\nRuby: 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]\nRubyGems: 2.7.7\nBundler: 1.16.2\nCompiled with: OpenSSL 1.0.2o 27 Mar 2018\nLoaded version: OpenSSL 1.0.2o 27 Mar 2018\nSSL_CERT_FILE: /usr/local/etc/openssl/cert.pem\nSSL_CERT_DIR: /usr/local/etc/openssl/certs\n\nWith that out of the way, let\'s see if you can connect to rubygems.org...\n\nBundler connection to rubygems.org: failed \xe2\x9d\x8c (execution expired)\nRubyGems connection to rubygems.org: failed \xe2\x9d\x8c (timed out (https://rubygems.org))\nRuby …Run Code Online (Sandbox Code Playgroud)