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

ReferenceError: Buffer is not defined on import in Nuxt3/Vue3 #430

Closed
rotsee opened this issue May 14, 2024 · 2 comments
Closed

ReferenceError: Buffer is not defined on import in Nuxt3/Vue3 #430

rotsee opened this issue May 14, 2024 · 2 comments

Comments

@rotsee
Copy link

rotsee commented May 14, 2024

Describe the bug

Trying to import parse fails in Nuxt and Vue codes with the error message ReferenceError: Buffer is not defined

To Reproduce
In a page or component, add the following import inside the script tag:

<script setup>
import { parse } from 'csv-parse/sync'
...
</script>

Then try navigating to that page

Additional context

Let me know if there is anything I can do that helps troubleshooting this.

@wdavidw
Copy link
Member

wdavidw commented May 14, 2024

I don't use these environment but you shall try the following distributions:

For example, with your example above:

<script setup>
import {parse} from 'csv-parse/browser/esm';
...
</script>

@rotsee
Copy link
Author

rotsee commented May 18, 2024

Thank you, using the browser dists works in all rendering modes in Nuxt, it seems!

@rotsee rotsee closed this as completed May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants