Language-tools: 별칭이 ν™•μΈλ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

에 λ§Œλ“  2020λ…„ 08μ›” 20일  Β·  10μ½”λ©˜νŠΈ  Β·  좜처: sveltejs/language-tools

버그 μ„€λͺ…
κ°€μ Έ 였기 별칭 @/ 을 μ‚¬μš©ν–ˆλŠ”λ° μ œλŒ€λ‘œ μž‘λ™ν–ˆμŠ΅λ‹ˆλ‹€. 그런 λ‹€μŒ Vite둜 μ „ν™˜ν–ˆκ³  루트 별칭 만 μ§€μ›ν•©λ‹ˆλ‹€. κ·Έλž˜μ„œ /@/ 별칭을 μ‚¬μš©ν•˜λ„λ‘ μ½”λ“œλ₯Ό μ „ν™˜ν–ˆμŠ΅λ‹ˆλ‹€. λΈŒλΌμš°μ €μ—μ„œ 컴파일되고 μž‘λ™ν•˜μ§€λ§Œ vscodeμ—μ„œ 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€.

image

μž¬ν˜„ν•˜λ €λ©΄
/@/ κ°€μ Έ 였기 μ‚¬μš©

μ˜ˆμƒλ˜λŠ” 행동
λͺ¨λ“  것이 μž‘λ™ν•©λ‹ˆλ‹€

μ‹œμŠ€ν…œ (λ‹€μŒ 정보λ₯Ό μž‘μ„±ν•˜μ‹­μ‹œμ˜€) :

  • 운영체제 : Ubuntu
  • IDE : VSCode
  • ν”ŒλŸ¬κ·ΈμΈ / νŒ¨ν‚€μ§€ : "Svelte for VSCode"
Fixed bug question

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

λ¬Έμ œλŠ” module-loader 에 있으며, "is absolute path"에 λŒ€ν•œ 검사가 μ°Έ (λ¦¬λˆ…μŠ€μ—μ„œ / 둜 μ‹œμž‘ν•˜λŠ” 파일 κ²½λ‘œλŠ” μ ˆλŒ€μ  μž„)μ΄λ―€λ‘œ 일반 TS ν•΄μƒλ„λ‘œ μœ„μž„ν•©λ‹ˆλ‹€. "tsconfig 경둜의 접두사 λΆ€λΆ„μž…λ‹ˆλ‹€"에 λŒ€ν•œ μΆ”κ°€ 검사가 ν•„μš”ν•˜λ‹€κ³  μƒκ°ν•©λ‹ˆλ‹€.

λͺ¨λ“  10 λŒ“κΈ€

λ˜ν•œ tsconfig / jsconfig.json을 톡해 typescript의 별칭을 κ΅¬μ„±ν•΄μ•Όν•©λ‹ˆλ‹€.

https://www.typescriptlang.org/docs/handbook/module-resolution.html#path -mapping

λ‚˜λŠ” λ˜ν•œ tsc 잘 컴파일 ν•  μˆ˜μžˆλŠ” λ™μΌν•œ λ¬Έμ œμ— μ§λ©΄ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ svelte-check 와 같은 λ„κ΅¬λŠ” 별칭 경둜λ₯Ό μ˜¬λ°”λ₯΄κ²Œ 확인할 수 μ—†μœΌλ©° OP와 같은 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€. ν”„λ‘œμ νŠΈ ν΄λ”μ—μ„œ tsconfig.json λ₯Ό μ œλŒ€λ‘œ ν•΄κ²°ν•  μˆ˜μ—†λŠ” language-tools κ΄€λ ¨ λ²„κ·Έκ°€μžˆλŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

Screenshot 2020-08-21 at 13 06 57

κ·Έ 였λ₯˜λŠ” svelte2tsx에 μ˜ν•΄ μ£Όμž… 된 일뢀 특수 속성을 μ‚¬μš©ν•˜μ—¬ ꡬ성 μš”μ†Œ μœ ν˜• 검사λ₯Ό μˆ˜ν–‰ν–ˆκΈ° λ•Œλ¬Έμž…λ‹ˆλ‹€. μ‹€μ œ νŒŒμΌμ„ 찾을 수 μ—†μœΌλ©΄ svelte2tsxλ₯Ό μ‚¬μš©ν•˜μ—¬ νŒŒμΌμ„ λ³€ν™˜ ν•  수 μ—†μŠ΅λ‹ˆλ‹€.

@cayter tsconfigλ₯Ό 어디에 λ„£μŠ΅λ‹ˆκΉŒ?

@ jasonlyu123 μ•„λž˜λŠ” λ°±μ—”λ“œ / ν”„λ‘ νŠΈ μ—”λ“œ λͺ¨λ‘μ— λŒ€ν•œ λͺ¨λ…Έ 레포 인 λ‚΄ ν”„λ‘œμ νŠΈ 폴더 κ΅¬μ‘°μž…λ‹ˆλ‹€.

.
β”œβ”€β”€ Makefile
β”œβ”€β”€ README.md
β”œβ”€β”€ database
β”‚   └── database.rules.json
β”œβ”€β”€ firebase.json
β”œβ”€β”€ firestore
β”‚   β”œβ”€β”€ firestore.indexes.json
β”‚   └── firestore.rules
β”œβ”€β”€ functions // backend code
β”‚   β”œβ”€β”€ package-lock.json
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ src
β”‚   β”‚   └── index.ts
β”‚   └── tsconfig.json
β”œβ”€β”€ hosting // frontend PWA code
β”‚   β”œβ”€β”€ ...
β”‚   β”œβ”€β”€ src
β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”‚   β”œβ”€β”€ App.svelte
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ images
β”‚   β”‚   β”‚   β”œβ”€β”€ cover.png
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ index.css
β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”œβ”€β”€ pages
β”‚   β”‚   β”‚   β”œβ”€β”€ Auth
β”‚   β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”‚   β”œβ”€β”€ Error
β”‚   β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”‚   β”œβ”€β”€ Home
β”‚   β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”‚   └── User
β”‚   β”‚   β”‚       └── ...
β”‚   β”‚   └── stores
β”‚   β”‚       └── ...
β”‚   β”œβ”€β”€ svelte.config.js
β”‚   β”œβ”€β”€ tailwind.config.js
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   β”œβ”€β”€ vite.config.ts
β”‚   └── workbox.config.js
β”œβ”€β”€ package-lock.json
└── package.json

hosting / tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "baseUrl": "src",
    "declaration": true,
    "emitDecoratorMetadata": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "importHelpers": true,
    "importsNotUsedAsValues": "error",
    "isolatedModules": true,
    "lib": ["dom", "esnext", "es6"],
    "module": "esnext",
    "moduleResolution": "node",
    "noEmit": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "rootDir": "src",
    "skipLibCheck": true,
    "sourceMap": true,
    "strict": true,
    "strictBindCallApply": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictNullChecks": true,
    "target": "esnext",
    "types": ["jest", "node", "svelte"],
    "paths": {
      "/@/*": ["*"]
    }
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules/*", "public/*"]
}

μ‹€μ œ νŒŒμΌμ„ 찾을 수 μ—†μœΌλ©΄ svelte2tsxλ₯Ό μ‚¬μš©ν•˜μ—¬ νŒŒμΌμ„ λ³€ν™˜ ν•  수 μ—†μŠ΅λ‹ˆλ‹€.

λ„€, 이것은 ν”„λ‘œμ νŠΈμ˜ tsconfig.json μ •μ˜ 된 별칭 경둜 확인과 관련이 μžˆμŠ΅λ‹ˆλ‹€. λ”°λΌμ„œ 별칭 경둜λ₯Ό μ‚¬μš©ν•˜λŠ” λŒ€μ‹  μƒλŒ€ 경둜둜 λ³€κ²½ν•˜λ©΄ vscode ν™•μž₯ 및 svelte-checkλŠ” ComboBox ꡬ성 μš”μ†Œμ— λŒ€ν•œ OP의 슀크린 μƒ·μ—μ„œ λ³Ό μˆ˜μžˆλŠ” 였λ₯˜λ₯Ό 더 이상 λ˜μ§€μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

vscode의 좜λ ₯ 채널을 확인할 수 μžˆμŠ΅λ‹ˆκΉŒ? 였λ₯Έμͺ½ λ“œλ‘­ λ‹€μš΄μ—μ„œ svelteλ₯Ό μ„ νƒν–ˆμŠ΅λ‹ˆλ‹€. 그리고 이것과 같은 것이 μžˆλŠ”μ§€ ν™•μΈν•˜μ‹­μ‹œμ˜€
Initialize new ts service at c:/Current Projects/svelte-app/tsconfig.json 및 여기에 둜그λ₯Ό κ²Œμ‹œν•˜μ‹­μ‹œμ˜€.

이것을 μž¬ν˜„ ν•  수 μžˆμŠ΅λ‹ˆλ‹€. μ–΄λ–€ 이유둜 getDefinitionAndBoundSpan λŠ” μ΄λŸ¬ν•œ μœ„μΉ˜μ—μ„œ κ°€μ Έμ˜¨ TS / JS νŒŒμΌμ„ 처리 ν•  수 β€‹β€‹μžˆμ§€λ§Œ .svelte νŒŒμΌμ€ 처리 ν•  수 β€‹β€‹μ—†μŠ΅λ‹ˆλ‹€.

λ¬Έμ œλŠ” module-loader 에 있으며, "is absolute path"에 λŒ€ν•œ 검사가 μ°Έ (λ¦¬λˆ…μŠ€μ—μ„œ / 둜 μ‹œμž‘ν•˜λŠ” 파일 κ²½λ‘œλŠ” μ ˆλŒ€μ  μž„)μ΄λ―€λ‘œ 일반 TS ν•΄μƒλ„λ‘œ μœ„μž„ν•©λ‹ˆλ‹€. "tsconfig 경둜의 접두사 λΆ€λΆ„μž…λ‹ˆλ‹€"에 λŒ€ν•œ μΆ”κ°€ 검사가 ν•„μš”ν•˜λ‹€κ³  μƒκ°ν•©λ‹ˆλ‹€.

OPλŠ” μ‹€μ œλ‘œ @/ μž‘λ™ν•œλ‹€κ³  λ§ν–ˆμ§€λ§Œ λ†“μ³€μŠ΅λ‹ˆλ‹€. μ£„μ†‘ν•©λ‹ˆλ‹€ πŸ˜…

λ„ˆν¬λ“€μ΄ μ–Όλ§ˆλ‚˜ 멋진 지 λ§ν•˜λŠ” 것을 μžŠμ—ˆλ‹€. λΉ λ₯Έ 응닡에 κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰