Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run with Vite & React 17 #21

Open
SaadBazaz opened this issue Jun 14, 2023 · 6 comments
Open

Can't run with Vite & React 17 #21

SaadBazaz opened this issue Jun 14, 2023 · 6 comments

Comments

@SaadBazaz
Copy link

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"
  }
}
@OrlandoNatsu
Copy link

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"
  }
}

could you solve ?

@SaadBazaz
Copy link
Author

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"
  }
}

could you solve ?

Nope.

@macabeus
Copy link
Owner

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

@TimKieu
Copy link

TimKieu commented Apr 12, 2024

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) ^^

@macabeus
Copy link
Owner

@TimKieu can you open a PR with the fixes, please?

@kaluxxx
Copy link

kaluxxx commented May 24, 2024

Hello, I have the same problem, I tried to replace ARMCoreArm by window.ARMCoreArm however that does not correct the problem on my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants