Skip to content

Warning on "use client" directive when using plugin alongside react #49

@KholdStare

Description

@KholdStare

When using this plugin alongside some react libraries, running a vite build results in a spew of errors like:

../node_modules/wagmi/dist/index.js (1:0) Module level directives cause errors when bundled, "use client" in "../node_modules/wagmi/dist/index.js" was ignored.

There are a bunch of issues filed in several libraries, but I think something is happening when using both this plugin and react, when dependencies use the new use client directive. See this issue in the rollup project:

rollup/rollup#4699

I have created a small stackblitz environment where running npm run build will result in these warnings:

https://stackblitz.com/edit/vitejs-vite-pcpqdr?file=vite.config.ts

The key thing to note is that just removing this plugin fixes all the warnings. So there is some funky interaction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions