在使用 Electron-Vite 构建小游戏时,遇到了一个关于资源文件路径的问题。以下是解决方案:
问题描述
资源文件需要放置在 /src/renderer/public 目录下,并在引用时使用相对路径,例如:
// 引入背景图片 import background from '/games/emoji-match/background.png?url'
项目地址
希望这个简短的解决方案能够帮助你顺利构建基于 Electron-Vite 的 Phaser.js 小游戏。
测试electron-vite打包phaser.js的小游戏
在使用 Electron-Vite 构建小游戏时,遇到了一个关于资源文件路径的问题。以下是解决方案:
资源文件需要放置在 /src/renderer/public 目录下,并在引用时使用相对路径,例如:
// 引入背景图片 import background from '/games/emoji-match/background.png?url'
希望这个简短的解决方案能够帮助你顺利构建基于 Electron-Vite 的 Phaser.js 小游戏。