C.W.K.
Stream
Lesson 03 of 06 · published

tauri.conf.json, 필드 하나씩

~14 min · tauri, config, tauri-conf, setup

Level 0웹 관광객
0 XP0/56 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete
"설정 파일은 웹 반쪽이랑 네이티브 반쪽 사이의 계약서야. 계약서처럼 읽어."

중요한 네 섹션

tauri.conf.json은 작지만 하중을 받쳐. 최상위 네 섹션이 일을 거의 다 해:

  • 신원productName, version, identifier(com.acme.myapp 같은 역DNS 문자열). identifier는 OS가 네 앱 데이터 폴더 이름을 짓고 번들에 서명하는 방식이야.
  • build — 프론트엔드 연결법: beforeDevCommand(dev 서버 시작), devUrl(어디 사는지, 예: http://localhost:1420), beforeBuildCommand(프로덕션 빌드), frontendDist(Tauri가 실어 보내는 빌드된 정적 파일 폴더).
  • app — 런타임 UI: 초기 windows 배열(크기, 제목, resizable…)이랑 security(특히 Content Security Policy).
  • bundle — 패키징: 번들링이 active인지, 어떤 targets를 빌드할지(.dmg, .msi, AppImage…), 그리고 icon 세트.

devUrl vs frontendDist: dev/prod 스위치

이 쌍은 누구나 한 번 헷갈려. dev에선 Tauri가 웹뷰를 devUrl로 가리켜 — 핫리로드되는 라이브 dev 서버. build에선 서버가 없어. Tauri가 앱 안에 번들된 frontendDist의 정적 파일을 로드해. 같은 앱, HTML 먹이는 방식 둘. 빌드한 앱은 빈 창인데 dev는 되면, frontendDist가 엉뚱한 폴더를 가리키는 게 흔한 범인이야.

스키마 줄은 네 친구야

첫 줄 "$schema": "https://schema.tauri.app/config/2"는 장식이 아냐 — 에디터에 모든 필드의 자동완성이랑 검증을 줘. 에디터에서 키가 빨개지면 오타거나 v2에 없는 거야. v1용으로 쓰인 블로그보다 스키마를 믿어.

Code

진짜 모양의 tauri.conf.json (Cinder가 쓰는 구조 그대로)·json
{
  "$schema": "https://schema.tauri.app/config/2",
  "productName": "My App",
  "version": "1.0.0",
  "identifier": "com.acme.myapp",
  "build": {
    "beforeDevCommand": "npm run dev",
    "devUrl": "http://localhost:1420",
    "beforeBuildCommand": "npm run build",
    "frontendDist": "../dist"
  },
  "app": {
    "windows": [
      { "title": "My App", "width": 1200, "height": 800, "resizable": true }
    ],
    "security": { "csp": null }
  },
  "bundle": {
    "active": true,
    "targets": "all",
    "icon": ["icons/128x128.png", "icons/icon.icns", "icons/icon.ico"]
  }
}

External links

Exercise

스캐폴딩한 앱의 tauri.conf.json을 열어. 창 제목이랑 inner size를 바꾸고, tauri dev 돌려서 네이티브 창에 반영되는지 확인해. 그다음 identifier를 찾아 — 진짜 역DNS 문자열이야, 아니면 스캐폴더가 남긴 placeholder야? 릴리스 빌드 한 번이라도 하기 전에 지금 고쳐.
Hint
창 설정은 app.windows[0] 아래. identifier는 최상위 키. 아직 com.tauri-app.dev 같은 거면 placeholder야 — com.네이름.앱이름으로 만들어.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.