Nuxt Upgrade - ChoDragon9/posts GitHub Wiki

์—…๊ทธ๋ ˆ์ด๋“œ ์ „๋žต

  • Release Note๋ฅผ ํ†ตํ•ด ๋ฒ„์ „์„ ํ•œ ๋‹จ๊ณ„์”ฉ ์˜ฌ๋ฆฐ๋‹ค.
  • ์ด์Šˆ๋Š” ๊ฒ€์ƒ‰์ด ์•ˆ๋  ์ˆ˜ ์žˆ์Œ. ํ˜„์ƒ์„ ๋ณด๊ณ  ํ•ด๊ฒฐํ•œ๋‹ค.

v2.9.2

Server ์ข…๋ฃŒ ๋˜๋Š” ํ˜„์ƒ ํ•ด๊ฒฐ

2.8.0 => 2.9.2 ๋ฒ„์ „ ์—…๊ทธ๋ ˆ์ด๋“œ ํ›„ SPA ๋ชจ๋“œ๋Š” ์ปค๋ฉ˜๋“œ ์˜ต์…˜์œผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ๋‹ค. ๊ฐœ๋ฐœ ๋‹จ๊ณ„ ์„œ๋ฒ„ ์‹คํ–‰ ์‹œ, nuxt --spa๋กœ ์‹คํ–‰ํ•ด์•ผ ํ•œ๋‹ค.

scrollBehavior

nuxt 2.9.x ๋ถ€ํ„ฐ app/router.scrollBehavior.js๋กœ ์ฒ˜๋ฆฌ

Decorator์—๋Ÿฌ ๋ฐœ์ƒ

nuxt.config.ts๋ฅผ ์ •์ƒ์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” @nuxt/typescript-runtime ๋ชจ๋“ˆ์„ ์„ค์น˜ํ•ด์•ผ ํ•œ๋‹ค. nuxt.config.ts์—๋Š” TypeScript๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์„ค์ •ํ•˜๋Š” ํŒŒ์ผ์ด ์žˆ๋‹ค. ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— Runtime ์„ค์ •๋„ ํ•„์š”ํ•˜๋‹ค.

์„ค์น˜ ํ›„์—๋Š” scripts์— nuxt๋กœ ์‚ฌ์šฉํ–ˆ๋˜ ๋ช…๋ น์–ด๋ฅผ nuxt-ts๋กœ ๋ณ€๊ฒฝ์ด ํ•„์š”ํ•˜๋‹ค.

@nuxt/typescript, nuxt v.2.11.1

nuxt.config.ts

- import NuxtConfiguration from '@nuxt/config'
+ import { Configuration } from '@nuxt/types'

- const config: NuxtConfiguration = {
+ const config: Configuration = {

-   devModules: [
-     // Doc: https://github.com/nuxt-community/eslint-module
-     '@nuxtjs/eslint-module'
-   ],

+   buildModules: [
+     [
+       '@nuxt/typescript-build',
+       {
+         typeCheck: true,
+         ignoreNotFoundWarnings: true
+       }
+     ]
+   ],

package.json

-    "dev": "nuxt",
-    "build": "nuxt build",
-    "generate": "nuxt generate",
-    "start": "nuxt start",
+    "dev": "nuxt-ts --spa",
+    "build": "nuxt-ts build --spa",
+    "generate": "nuxt-ts generate",
+    "start": "nuxt-ts start",
"dependencies": {
+    "@nuxt/typescript-runtime": "^0.3.3",
-    "nuxt": "^2.0.0",
+    "nuxt": "^2.11.0",
"devDependencies": {
-    "@nuxt/typescript": "^2.8.1",
+    "@nuxt/typescript-build": "^0.5.2",

tsconfig.json

-  "@nuxt/vue-app",
-  "@nuxt/config"
+  "@nuxt/types"

middleware

- import { Middleware } from '@nuxt/vue-app'
+ import { Middleware } from '@nuxt/types'