Skip to content

Commit ef17ba9

Browse files
authored
fix: 修复 JSON 格式错误导致模型不可用的问题 (#790)
1 parent d69669b commit ef17ba9

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"dayjs": "^1.11.13",
4040
"es-toolkit": "^1.38.0",
4141
"is-url": "^1.2.4",
42+
"json5": "^2.2.3",
4243
"nanoid": "^5.1.5",
4344
"pinia": "^3.0.3",
4445
"pixi-live2d-display": "^0.4.0",

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/live2d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { Cubism4InternalModel } from 'pixi-live2d-display'
33

44
import { convertFileSrc } from '@tauri-apps/api/core'
55
import { readDir, readTextFile } from '@tauri-apps/plugin-fs'
6+
import JSON5 from 'json5'
67
import { Cubism4ModelSettings, Live2DModel } from 'pixi-live2d-display'
78
import { Application, Ticker } from 'pixi.js'
89

@@ -46,7 +47,7 @@ class Live2d {
4647

4748
const modelPath = join(path, modelFile.name)
4849

49-
const modelJSON = JSON.parse(await readTextFile(modelPath))
50+
const modelJSON = JSON5.parse(await readTextFile(modelPath))
5051

5152
const modelSettings = new Cubism4ModelSettings({
5253
...modelJSON,

0 commit comments

Comments
 (0)