hiukim / mind-ar-js

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js
MIT License
2.14k stars 394 forks source link

1.2.0 breaks static app build (create-react-app) #343

Closed jotatoledo closed 1 year ago

jotatoledo commented 1 year ago

Currently an application built with create-react-app will work correctly during development but will fail once deployed with the error: require not defined

Seems like the bundle will contain multiple calls to require(path-to-system-file). Most likely realted to the new build system?

package.json:

{
  "name": "@kunsthalle/ar-painting",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "node": ">=16.18.0 <17",
    "npm": ">=8.19.2 <9"
  },
  "dependencies": {
    "@emotion/react": "^11.10.5",
    "@emotion/styled": "^11.10.5",
    "@fontsource/roboto": "^4.5.8",
    "@mui/icons-material": "^5.10.9",
    "@mui/lab": "^5.0.0-alpha.111",
    "@mui/material": "^5.10.13",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "aframe": "~1.3.0",
    "html5-qrcode": "^2.3.4",
    "mind-ar": "^1.2.0",
    "immer": "^9.0.16",
    "localforage": "^1.10.0",
    "match-sorter": "^6.3.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.4.3",
    "react-scripts": "5.0.1",
    "sort-by": "^1.2.0",
    "web-vitals": "^2.1.4",
    "workbox-background-sync": "^6.4.2",
    "workbox-broadcast-update": "^6.4.2",
    "workbox-cacheable-response": "^6.4.2",
    "workbox-core": "^6.4.2",
    "workbox-expiration": "^6.4.2",
    "workbox-google-analytics": "^6.4.2",
    "workbox-navigation-preload": "^6.4.2",
    "workbox-precaching": "^6.4.2",
    "workbox-range-requests": "^6.4.2",
    "workbox-routing": "^6.4.2",
    "workbox-strategies": "^6.4.2",
    "workbox-streams": "^6.4.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "tunnel": "ngrok http 3000"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@types/aframe": "^1.2.1",
    "@types/jest": "^27.5.2",
    "@types/node": "^16.18.3",
    "@types/react": "^18.0.25",
    "@types/react-dom": "^18.0.8",
    "eslint-config-prettier": "^8.5.0",
    "eslint-config-react-app": "^7.0.1",
    "prettier": "^2.7.1",
    "types-aframe-react": "^1.0.2",
    "typescript": "^4.8.4"
  }
}
ankitgupta401 commented 1 year ago

did you find the solution?

jotatoledo commented 1 year ago

did you find the solution?

deployed my own patched version of mind-ar with the app, didnt had time to look into the issue sorry

ankitgupta401 commented 1 year ago

did you find the solution?

deployed my own patched version of mind-ar with the app, didnt had time to look into the issue sorry

Can you please share your patched version?

jotatoledo commented 1 year ago

did you find the solution?

deployed my own patched version of mind-ar with the app, didnt had time to look into the issue sorry

Can you please share your patched version?

What I meant with patched was that I took the previous version and I applied some of the changes in the latest version (with exception of the build system change ofc). You can easily do the same locally.

chirag-aura commented 1 year ago

@ankitgupta401 solved this issue?

ankitgupta401 commented 1 year ago

@ankitgupta401 solved this issue?

We used the cdn version of mind-ar

chirag-aura commented 1 year ago

@ankitgupta401 solved this issue?

We used the cdn version of mind-ar

image import like this in App.js can I replace it with cdn or need to change whole library

hiukim commented 1 year ago

duplicated issue: https://github.com/hiukim/mind-ar-js-react/issues/7