Skip to content

Add an option to transpile .js file with esbuild #769

@pd4d10

Description

@pd4d10

In React development case it is a common habit to use .js file instead of .jsx for JSX component.

Vite seems simply skips the esbuild plugin if the file name does not match this Regex:

export const tjsxRE = /\.(tsx?|jsx)$/

if (
!tjsxRE.test(ctx.path) ||
!ctx.body ||
ctx.type === 'text/html' ||
resolver.isPublicRequest(ctx.path)
) {
return
}

which means only .ts, .tsx and .jsx files would have the opportunity to be transpiled by esbuild.

How about adding an option to also transpile .js file with esbuild? It would be great for React developers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions