-
Notifications
You must be signed in to change notification settings - Fork 43
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
Error when packing webm-writer with Webpack #16
Comments
Could you provide an example project that uses Webpack that I can use for testing? I don't use Webpack myself so I'm not sure how it would be set u p. |
Sure thing :) Here I prepared a working setup: To get it working I had to add to my basic setup (https://github.com/HerrZatacke/webm-writer-webpack-demo/blob/master/scripts/webpack.common.js#L13) node: {
fs: 'empty',
} This config is an okay-ish thing, but as webpack is resolving and packing all files that are referenced via
I understand you went a different approach because you are using the lib mainly on the server (electron) side, which does not cause that problem. Yet webpack is (in my opinion, mostly the de-facto) standard when building web-applications, so allowing that would be much appreciated. Maybe it could work using the browser property in your package.json. If you want, I can give it a try solving this issue? |
Creating webpack-compatibility was easier than I expected. I'm using the above mentioned "browser" property in the package.json |
Was looking for the same thing as well, I ended up doing config.module.rules.push({
test: /webm-writer[\\/]/,
loader: 'string-replace-loader',
options: {
search: 'require(\'fs\')',
replace: 'null'
}
}); would love to have 1st party support though. |
Hey Guys,
I tried to include the webm-write with webpack, yet it tries to load the 'fs' (node) module on compile
I figured out (using webpack 4) you can add the following to your webpack config to prevent that error from happening.
Yet, I don't know if it'd possible to remove that requirement, maybe by passing
fs
as an optional parameter.This would allow people to add their own implementations of
fs
as well. (like fs-extra if desired)Suggestion if you do not need fs:
Or with a custom implementation:
Could be useful for some unit-tests as well...
The text was updated successfully, but these errors were encountered: