adaltas/node-csv

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

rotsee opened this issue · 2 comments

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.

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>

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