Webpack entry cannot be found after importing filer
See original GitHub issueContext
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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (12 by maintainers)
Top Results From Across the Web
ERROR in Entry module not found: Error: Cannot resolve 'file ...
Hi everybody. I'm simply trying to use webpack but i can't solve this error. This is my webpack.config.js : module.exports = { entry:...
Read more >Webpack 5 entry point now failing on imports - Stack Overflow
The project runs with "webpack serve" but I get the error "SyntaxError: Cannot use import statement outside a module" in the entry point...
Read more >Entry Points - webpack
They must be loaded before this entry point is loaded. filename : Specifies the name of each output file on disk. import :...
Read more >TypeScript - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >Output Management - webpack
Let's fix that with the HtmlWebpackPlugin . Setting up HtmlWebpackPlugin. First install the plugin and adjust the webpack.config.js file: npm ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No problem!
@humphd shall we proceed with PR #793 so we can close this issue?
EDIT: I have seen the other issue about the shims not being present in the version distributed through npm - don’t have time to address that until this evening or tomorrow but we should probably ship any fix for that with the fix for this issue imo
Confirmed, the correct files have been pushed to NPM