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

Provide option to Preserve directives during build #274

Open
1 task done
Mutesa-Cedric opened this issue Dec 19, 2024 · 2 comments
Open
1 task done

Provide option to Preserve directives during build #274

Mutesa-Cedric opened this issue Dec 19, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Mutesa-Cedric
Copy link

Describe the feature

I'm building a react library and want to keep "use client" directive during build, but I can't find that option anywhere.

Additional information

  • Would you be willing to help implement this feature?
@Mutesa-Cedric Mutesa-Cedric added the enhancement New feature or request label Dec 19, 2024
@pi0
Copy link
Member

pi0 commented Dec 19, 2024

I think this will be only possible in mkdist mode without bundling as it can preserve directives per component file when bundling it isn’t possible.

@Mutesa-Cedric
Copy link
Author

I tried in mkdist mode but directives are still being ignored with this message :

src/HOC/wrapper.tsx (1:0): Module level directives cause errors when bundled, "use client" in "src/HOC/wrapper.tsx" was ignored.
src/lib/Base.jsx (1:0): Module level directives cause errors when bundled, "use client" in "src/lib/Base.jsx" was ignored.

@pi0 pi0 transferred this issue from unjs/unbuild Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants