lhapaipai / vite-plugin-symfony

Vite plugin to use your bundler with Symfony
https://symfony-vite.pentatrion.com
Other
43 stars 11 forks source link

"Entry points must be inside Vite root directory" error with vite 2.8 #3

Closed Vincz closed 2 years ago

Vincz commented 2 years ago

With the latest vite version (2.8), we get the following error due to the Symfony Plugin:

Entry points must be inside Vite root directory

Vincz commented 2 years ago

Ok, it's just a matter of root directory. Reconfigure the path relative to the root of the project instead of ./assets fix the problem.

The new default config file should be something like this:

// vite.config.js
import {defineConfig} from "vite";
import symfonyPlugin from "vite-plugin-symfony";
/* if you're using React */
// import reactRefresh from "@vitejs/plugin-react-refresh";

export default defineConfig({
    plugins: [
        /* reactRefresh(), // if you're using React */
        symfonyPlugin(),
    ],

    root: "./", // <--- INSTEAD OF ./assets/

    /* your outDir web path prefix */
    base: "/build/",
    build: {
        manifest: true,
        emptyOutDir: true,
        assetsDir: "",
        outDir: "./public/build/", // <--- INSTEAD OF ../public/build/
        rollupOptions: {
            input: {
              app: "./assets/app.ts" // <--- INSTEAD OF "./app.ts
            },
        },
    }
});
lhapaipai commented 2 years ago

Thanks @Vincz for your feedback ! I adapted the configuration with your vite config. good night

FluffyDiscord commented 2 years ago

this makes vite hang forever for some reason, maybe because the root dir is set to "./" and it wants to scan my whole project (its really big)