Страницы GitHub. При развёртывании проекта возникает ошибка

Проект React+Vite. При развёртывании возникает ошибка: Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/jsx". Strict MIME type checking is enforced for module scripts per HTML spec.(main.jsx:1) Нашла советы вот в этом вопросе https://stackoverflow.com/questions/73749664/github-pages-link-empty-and-error-failed-to-load-module-script. Собрала свой проект с помощью npm run build и при публикации пользовалась инструкцией https://vitejs.dev/guide/static-deploy.html.

main.jsx :

import React from 'react'
import ReactDOM from 'react-dom/client'
import './index.css'
import App from './App'

ReactDOM.createRoot(document.getElementById('root')).render( < App / > )

vite.config.js:

import {
  defineConfig
} from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react()],
  base: '/country_guide/'
})

package.json:

{
  "name": "courseinfo",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },
  "dependencies": {
    "axios": "^1.6.2",
    "dotenv": "^16.4.1",
    "gh-pages": "^6.1.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/react": "^18.2.37",
    "@types/react-dom": "^18.2.15",
    "@vitejs/plugin-react": "^4.2.0",
    "eslint": "^8.53.0",
    "eslint-plugin-react": "^7.33.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.4",
    "json-server": "^0.17.4",
    "vite": "^5.0.0"
  }
}

Для сборки на GitHub использовала вариант Deploy Jekyll with GitHub Pages dependencies preinstalled.


Ответы (0 шт):