#Getting Uncaught TypeError: The specifier “fs” was a bare specifier

1 messages · Page 1 of 1 (latest)

main yacht
#

Full error message: Uncaught TypeError: The specifier “fs” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.
I am writing import * as fs from 'fs';
Even tried import fs from 'fs';
What am I doing wrong?

teal salmon
#

you can't import fs from the browser

main yacht
#

then what can I do?

#

on client-side

storm grove
#

It depends on what you're using fs for, but generally any file system access goes through the browser's File System API.

#

It's more restricted than the fs module though; for good reason, browsers don't want to give websites full access to the users file system

main yacht
#

Ohk. Let me try it. Thanks for the link

main yacht
storm grove
#

You may want to look at a bundler