0

Every time i try to do npm run build and and run preview the site fails to load and i end up with the set of errors below telling me it failed to load resources :enter image description here. Although everything runs perfectly fine when i do npm run dev...

I've been trying to mess around with the build rollup config as suggested here on stack overflow but idont know exactly what else to do:Vite - How do I use a wildcard in Rollupjs build.rollupOptions.external?

 build: {
    rollupOptions: {
      output: {
        manualChunks(id) {
          if (id.includes("node_modules")) {
            return id
              .toString()
              .split("node_modules/")[1]
              .split("/")[0]
              .toString();
          }
        },
      },
    },
  },

I've also tried messing around with with the main.js file as it was suggested here as well but i still ended up with a missing file and despite only being one file (less than before!)the build preview never loaded all in all i feel pretty lost any help would be sincerely appreciated!

Heres some more details of my package.json:

"name": "testr",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },


  "devDependencies": {
    "@types/react": "^18.2.21",
    "@types/react-dom": "^18.2.7",
    "@vitejs/plugin-react": "^4.0.4",
    "glslify": "^7.1.1",
    "prettier": "3.0.2",
    "rollup": "^3.28.1",
    "vite": "^4.4.9"
  }
}

** file structure edit how im importing the glb files:enter image description hereenter image description here **

ive also tried suggestions from here but with no luck.. Reactjs missing files when running `npm run build`

0 Answers0