RobertBoes / sidecar-inertia-vite

A Sidecar function to run Inertia server-side rendering with Vite on Lambda.
MIT License
17 stars 7 forks source link

"Entry Point Not Found in index.mjs When Packaged with NCC" or srr.handler not found when not packaged #7

Open rasmus393 opened 5 months ago

rasmus393 commented 5 months ago

I'm encountering an issue where index.mjs does not export a handler function, resulting in a lack of an entry point for rendering, regardless of packaging with NCC. This issue persists, leading me to suspect it might be related to versioning problems due to the package's age. However, I'm unable to pinpoint the exact issue within my setup.

I am using Node 20 and vite version 5.1.4 to built it.

This is my vite config for now I rename as it seems that this package only supports if endings are .mjs

"import { fileURLToPath, URL } from 'node:url'; import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; import DefineOptions from 'unplugin-vue-define-options/vite'; import visualizer from 'rollup-plugin-visualizer'; import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        DefineOptions(),
        laravel({
            input: [
                'resources/js/app.js'
            ],
            ssr: 'resources/js/ssr.js',
            refresh: true,
        }),
        vue({
            template: {
                transformAssetUrls: {
                    includeAbsolute: false,
                },
            },
        }),
    ],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./resources', import.meta.url)),
        },
    },
    server: {
        hmr: {
            protocol: 'ws',
        },
    },
    ssr: {
        noExternal: ['@inertiajs/server', 'vue3-google-map'],
    },
    build: {
        rollupOptions: {
            output: {
                // Change file extension to .mjs for ESM modules
                entryFileNames: `[name].mjs`,
                chunkFileNames: `[name].mjs`,
                assetFileNames: `[name].[ext]`
            }
        },
    },
});

Checked for any potential setup mistakes: Reviewed the package and sidecar documentation for any changes Searched for similar issues on GitHub and Stack Overflow. tried various configs