Rollup failed to resolve file JS

Viewed 2206

I have an error when I build my project using vite like this:

[vite]: Rollup failed to resolve import "src/main.js" from "resepsionis/index.html".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "src/main.js" from "resepsionis/index.html".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at onRollupWarning (/var/www/hotel-hebat/node_modules/vite/dist/node/chunks/dep-9c153816.js:39242:19)
    at onwarn (/var/www/hotel-hebat/node_modules/vite/dist/node/chunks/dep-9c153816.js:39020:13)
    at Object.onwarn (/var/www/hotel-hebat/node_modules/rollup/dist/shared/rollup.js:23129:13)
    at ModuleLoader.handleResolveId (/var/www/hotel-hebat/node_modules/rollup/dist/shared/rollup.js:22419:26)
    at /var/www/hotel-hebat/node_modules/rollup/dist/shared/rollup.js:22380:26

I want to build a multiple page application, each application has its own task. Here is my vite config:

import { fileURLToPath, URL } from "url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import { resolve } from "path";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), vueJsx()],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("src", import.meta.url)),
    },
  },
  build: {
    rollupOptions: {
      input: {
        main: resolve(__dirname, 'index.html'),
        resepsionis: resolve(__dirname, 'resepsionis/index.html')
      },
      external: [
        'vue', resolve(__dirname, 'resepsionis/src/main.js'), /node_modules/
      ]
    }
  },
});

and here is my structure folder: structure folder

0 Answers
Related