Context
I am trying to add FilerWebpackPlugin to an existing Webpack configuration.
Problem
As soon as I require('filer'), Webpack starts failing because it cannot find the entry file anymore.
Analysis
This problem seems to be caused by a side effect in src/path.js:
/**
* Patch process to add process.cwd(), always giving the root dir.
* NOTE: this line needs to happen *before* we require in `path`.
*/
process.cwd = () => '/';
Workaround
The only workaround that I found is to save process.cwd before importing filer, and to restore it afterwards.
const cwd = process.cwd;
const filer = require('filer');
process.cwd = cwd;
With this fix, Webpack is able to find the entry file again.
Context
I am trying to add
FilerWebpackPluginto an existing Webpack configuration.Problem
As soon as I
require('filer'), Webpack starts failing because it cannot find the entry file anymore.Analysis
This problem seems to be caused by a side effect in
src/path.js:Workaround
The only workaround that I found is to save
process.cwdbefore importingfiler, and to restore it afterwards.With this fix, Webpack is able to find the entry file again.