react-gbajs
react-gbajs copied to clipboard
Can't run with Vite & React 17
Hey, I'm getting the following error:
arm.js:1 Uncaught ReferenceError: ARMCoreArm is not defined
at Object.<anonymous> (arm.js:1:1)
at i2 (bootstrap:19:22)
at Module.<anonymous> (util.js:245:20)
at i2 (bootstrap:19:22)
at bootstrap:83:10
at node_modules/react-gbajs/dist/react-gbajs.js (bootstrap:83:54)
at __require (chunk-NCIHTZFX.js?v=f314ad2b:3:50)
at index.ts:6:16
My project:
{
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-gbajs": "^1.0.3"
},
"devDependencies": {
"@types/react": "^17.0.9",
"@types/react-dom": "^17.0.9",
"@vitejs/plugin-react": "^4.0.0",
"eslint": "^8.38.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"vite": "^4.3.9"
}
}
Hey, I'm getting the following error:
arm.js:1 Uncaught ReferenceError: ARMCoreArm is not defined at Object.<anonymous> (arm.js:1:1) at i2 (bootstrap:19:22) at Module.<anonymous> (util.js:245:20) at i2 (bootstrap:19:22) at bootstrap:83:10 at node_modules/react-gbajs/dist/react-gbajs.js (bootstrap:83:54) at __require (chunk-NCIHTZFX.js?v=f314ad2b:3:50) at index.ts:6:16My project:
{ "type": "module", "scripts": { "dev": "vite", "build": "vite build", "lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, "dependencies": { "react": "^17.0.2", "react-dom": "^17.0.2", "react-gbajs": "^1.0.3" }, "devDependencies": { "@types/react": "^17.0.9", "@types/react-dom": "^17.0.9", "@vitejs/plugin-react": "^4.0.0", "eslint": "^8.38.0", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.3.4", "vite": "^4.3.9" } }
could you solve ?
Hey, I'm getting the following error:
arm.js:1 Uncaught ReferenceError: ARMCoreArm is not defined at Object.<anonymous> (arm.js:1:1) at i2 (bootstrap:19:22) at Module.<anonymous> (util.js:245:20) at i2 (bootstrap:19:22) at bootstrap:83:10 at node_modules/react-gbajs/dist/react-gbajs.js (bootstrap:83:54) at __require (chunk-NCIHTZFX.js?v=f314ad2b:3:50) at index.ts:6:16My project:
{ "type": "module", "scripts": { "dev": "vite", "build": "vite build", "lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, "dependencies": { "react": "^17.0.2", "react-dom": "^17.0.2", "react-gbajs": "^1.0.3" }, "devDependencies": { "@types/react": "^17.0.9", "@types/react-dom": "^17.0.9", "@vitejs/plugin-react": "^4.0.0", "eslint": "^8.38.0", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.3.4", "vite": "^4.3.9" } }could you solve ?
Nope.
It's probably possible to solve it by replacing ARMCoreArm with window.ARMCoreArm here:
https://github.com/macabeus/react-gbajs/blob/7efd0e03c1d36eb0f1bf50c53d97d2215f5d6236/src/emulator/arm.js#L1C1-L1C11
I'm busy with other things, and I might not try it on the following days.
If someone is available to test it and open a PR fixing the build when using vite, feel free
Yes, @macabeus @SaadBazaz and for Vite React, we should do fix more at:
- Loading bin file: assets/bios.bin or injected as bytearray
export default defineConfig({
assetsInclude: ['**/*.bin'],
})
- upgrade dependencies (dev, peer), now is React 18+, node 18+
I am still testing to play the Kage (Shadow Ninja) ^^
@TimKieu can you open a PR with the fixes, please?
Hello, I have the same problem, I tried to replace ARMCoreArm by window.ARMCoreArm however that does not correct the problem on my side.