-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
Doesn't work in browser (requires fs) #903
Comments
Also trying to get Jimp to work in browser. Using Node v12 on Windows and I get this: |
This is annoying as it is supposed to work for browser builds. There is a workaround for this I think when using webpack - just add an alias for fs in your webpack config that points to an empty file. I have only just built this though - I haven't tested it within the browser yet. |
Is there any update on this bug? Same issue occurs for me as well. The workaround suggested by @taskbox-joe doesn't work for me either... Even with FS installed as a dependency in the project. Edit: The real workaround is adding this to your webpack.config:
|
If you are using Webpack 5, try this Disable
Add polyfill using plugin node-polyfill-webpack-plugin
It works for me |
Bump. Trying to use this with a NextJS project and finding out it doesn't work client-side which is a real bummer. |
@kyle-jorve I just got this working on NextJS client-side using @MXXXXXS's suggestion by making this change in const nextConfig = {
reactStrictMode: true,
webpack: (config, options) => {
if (options.isServer) {
return config
}
else {
config.resolve.fallback.fs = false
return config
}
}
} |
With the new webpack browser bundle #1140 this should be fine now |
Expected Behavior
This should function in the browser.
It should function here:
https://www.pika.dev/npm/jimp/repl
It should be possible to include the module with webpack.
Current Behavior
@jimp/core requires mkdirp which requires fs
@jimp/gif requires fs
Setting process.browser has no effect here.
I should be able to build with webpack, rollup, or snowpack.
Failure Information (for bugs)
A webpack build:
Steps to Reproduce
Context
Failure Logs
See above
The text was updated successfully, but these errors were encountered: