argon2-browser
argon2-browser copied to clipboard
Module not found: Error: Can't resolve 'fs' in xxx
Got this failure in recent upgrade. I've tried some solutions, such as https://github.com/webpack-contrib/css-loader/issues/447, but unlucky so far. Can you help?
Compiled with problems:X
ERROR in ./node_modules/argon2-browser/dist/argon2.js 49:26-39
Module not found: Error: Can't resolve 'fs' in '/frontend/node_modules/argon2-browser/dist'
Hi, I had the same problem and used browser compatible deps as placeholders for the fs, path, and crypto packages. Hopes this can help you.
"dependencies": {
...
"crypto": "npm:crypto-browserify",
"crypto-browserify": "^3.12.0",
"fs": "npm:fs-browsers",
"fs-browsers": "^1.1.6",
"path": "npm:path-browserify",
"path-browserify": "^1.0.1",
...
}
Wonder if there's a better way around this ... I'd prefer to stay away from introducing new dependencies to solve this issue.
@antelle would you have any solutions for this? - I'm running a Next.js application and need to use argon2-browser
.
Edit:
The example provided in this repo worked perfectly for nextjs
Did you try to disable those in the package.json
file?
"browser": {
"fs": false
},
@dangtony98 the example you linked is doing exactly this in the configuration file next.config.js
:
if (!isServer) {
config.resolve.fallback.fs = false;
}
Could not find any of the solutions above to get them to work on NextJS 14. I'm using it with skiff-crypto