Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript: define entrypoints using object #298

Merged
merged 1 commit into from
Jul 8, 2024

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.

@taylorotwell taylorotwell merged commit 83e95a5 into laravel:1.x Jul 8, 2024
5 checks passed
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