-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Getting "this.outputFileSystem.join is not a function" when used in webpack outputFileSystem #404
Comments
this.outputFileSystem.join is not a function
when used in webpack outputFileSystem
I second this, just ran into the same problem, currently working on a hack but I would like if this was implemented into the library. |
Actually, this bug is a part of Such method shouldn't be implemented inside of FS (as it's not part of standard, and it has nothing to do with it). Instead of that, I suggest to monkey patch file system used for Webpack: const joinPath = require('memory-fs/lib/join')
function ensureWebpackMemoryFs (fs) {
// Return it back, when it has Webpack 'join' method
if (fs.join) {
return fs
}
// Create FS proxy, adding `join` method to memfs, but not modifying original object
const nextFs = Object.create(fs)
nextFs.join = joinPath
return nextFs
}
// Usage with Webpack:
function buildWebpackCompiler (fs, webpackConfig) {
const webpackFs = ensureWebpackMemoryFs(fs)
const compiler = webpack(webpackConfig)
compiler.outputFileSystem = webpackFs
compiler.resolvers.context.fileSystem = webpackFs
return compiler
} Using |
Thanks @rangoo94 this is what I ended doing. |
@rangoo94 where/to which file should this monkey patch be added? i'm running into this error on npm start on webpack 4.47.0. |
@conorkenahan, I used it for the FS instance passed to the compiler via I'm not sure if it will work for you - my case was quite uncommon, I did want to get the output from memory and into memory, to avoid writes in the real filesystem. If that's what you expect, I think that it should work for you 👍 |
Hi, I'm getting this exception when using as the output of webpack
Error:
Not really sure what is the issue, but pretty sure join is not in the memfs API.
Can I use this as the outputFileSystem for webpack?
The text was updated successfully, but these errors were encountered: