Skip to content

Conversation

tylerlwsmith
Copy link
Contributor

Vite & Rollup use the type InputOption for input entrypoints (Rollup docs). The type definition is below (source):

export type InputOption = string | string[] | { [entryAlias: string]: string };

However, the Laravel Vite Plugin currently only supports the type string | string[] for its input entrypoints.

This PR changes the input and ssr fields to use Rollup's InputOption, enabling users to specify the names of their entrypoint's output files. This behavior is already supported by the Laravel Vite Plugin, but TypeScript currently shows warnings in vite.config.ts when an object is used to specify entrypoints in the input or ssr fields.

Here is what it looks like to specify output filenames using an object in Vite:

export default defineConfig({
  plugins: [
    laravel({
      input: {
        "output-filename.js": "resources/js/input-filename.js",
      },
    }),
  ],
});

The PR also adds tests to ensure that the input and ssr fields will accept a string, array of strings, and input object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants