It looks like csv-writer makes use of NodeJS file system APIs (at least from what I can tell by taking a quick look at it). If that’s the case, it isn’t compatible with UXP (which doesn’t provide NodeJS APIs).
Note that (if the module was compatible) you would need to use something like webpack to be able to require() stuff from node_modules.
In this case, however, it looks like that won’t be an option as the module isn’t compatible, to begin with.
Because of this, my recommendation would be to search for a “pure” CSV parser/serializer (that doesn’t interact with the file system, but just parses strings to objects and vice versa) and then use UXP’s integrated file system APIs to actually read/write the file.
@siam009 Forgive my careless response - Pablo’s answer is correct! My recommendation above won’t work because of the limitations of UXP right now. To add to his answer, you’ll find that getFileForOpening() and getFileForSaving() both require user interaction via a file picker dialog.