Skip to content

Vite plugins (e.g. Babel) not executed for entrypoints #504

Closed as not planned
Closed as not planned

Description

@dword-design

Describe the bug

Vite plugins aren't executed for entrypoints. Reason is probably because they are loaded via jiti. I like to use some babel plugins for my projects, so it would be great if entrypoints are processed regularly via Vite.

To Reproduce

// wxt.config.js

import { defineConfig } from 'wxt';
import babel from 'vite-plugin-babel'

export default defineConfig({
  vite: () => ({
    plugins: [babel()],
  }),
});
// entrypoints/background.js

import map from 'lodash/fp/map'

// use some babel plugin here
export default defineBackground(() => console.log([1, 2] |> map(x => x * 2))

Expected behavior

The code runs through.

Actual behavior

Builds exits with a parsing error.

Additional context

It works with vite-plugin-web-extension and Nuxt.

Activity

  1. added
    pending-triage
    on Feb 29, 2024
  2. aklinker1 commented on Feb 29, 2024

    @aklinker1
    Member

    Yeah, for this to work we'd have to use vite to transpile the entrypoints. I will look into this after some of the other large issues are handled.

    For now, you can use custom plugins in other files, just not the entrypoints.

  3. added and removed
    pending-triage
    on Feb 29, 2024
  4. added this to the v1.2 milestone on Mar 3, 2024
  5. aklinker1 commented on May 3, 2024

    @aklinker1
    Member

    I'm gonna close this issue, it will be fixed in #506, follow that one for updates.

  6. added
    vite plugin
    and removed
    vite plugin
    on Jul 6, 2024
  7. added theissue type on Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions