Error: vite build in github actions - for using aliases

18 Views Asked by At

When I use github actions to run vite build, I get the following error (locally it works fine): enter image description here

And if the aliases are being declared:

vite.config.ts ----------------------------------------->

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
import alias from "@rollup/plugin-alias";

console.log("vite.config.ts");

// https://vitejs.dev/config/
export default defineConfig(async () => ({
  plugins: [react(), alias()],

  resolve: {
    alias: {
      "@view": path.resolve(__dirname, "rosiv-web/src"),
      "@api": path.resolve(__dirname, "src"),
    },
  },

  // Vite options tailored for Tauri development and only applied in tauri dev or tauri build

  // 1. prevent vite from obscuring rust errors
  clearScreen: false,
  // 2. tauri expects a fixed port, fail if that port is not available
  server: {
    port: 1420,
    strictPort: true,
    watch: {
      // 3. tell vite to ignore watching src-tauri
      ignored: ["*/src-tauri/*"],
    },
  },
  envPrefix: ["VITE_", "TAURI_"],
}));

tsconfig.ts ----------------------------------------------->

{
  "compilerOptions": {
    "target": "ES2020",
    "useDefineForClassFields": true,
    "lib": ["ES2020", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "skipLibCheck": true,

    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",

    /* Linting */
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,
    "noUncheckedIndexedAccess": true,
    
    "baseUrl": ".",
    "paths": {
      "@view/*": ["rosiv-web/src/*"],
      "@api/*": ["src/*"]
    }
  },
  "include": ["src", "rosiv-web/src"],
  "references": [{ "path": "./tsconfig.node.json" }]
}

0

There are 0 best solutions below