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

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

Closed
Tracked by #506
dword-design opened this issue Feb 29, 2024 · 2 comments
Closed
Tracked by #506

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

dword-design opened this issue Feb 29, 2024 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists
Milestone

Comments

@dword-design
Copy link

dword-design commented Feb 29, 2024

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.

@dword-design dword-design added the triage Bug or problem that needs to be looked into label Feb 29, 2024
@aklinker1
Copy link
Collaborator

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.

@aklinker1 aklinker1 added bug Something isn't working and removed triage Bug or problem that needs to be looked into labels Feb 29, 2024
@aklinker1 aklinker1 added this to the v1.2 milestone Mar 3, 2024
@aklinker1 aklinker1 added the duplicate This issue or pull request already exists label May 3, 2024
@aklinker1
Copy link
Collaborator

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

@aklinker1 aklinker1 closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants