Can't resolve 'file-loader'
See original GitHub issueWhen I run
yarn install --production
NODE_ENV=production ./node_modules/.bin/encore production
I get
Syntax Error: ModuleNotFoundError: Module not found: Error: Can't resolve 'file-loader' in '/var/www/vagrant.assurancevie.com/current'
But the module file-loader
is installed. It’s not in node_modules
but in node_modules/@symfony/webpack-encore/node_modules
because I have another library requiring another version of file-loader
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Webpack: cannot resolve module 'file-loader' - Stack Overflow
Error: Module not found : Can't resolve 'url-loader'. Fixed by installing url-loader , ex: run 'npm install url-loader --save-dev'.
Read more >file-loader - npm
The file-loader resolves import / require() on a file into a url and emits the file into the output directory.
Read more >Webpack: cannot resolve module 'file-loader' - iTecNote
When I try to build SASS file with webpack, I got the following error: Module not found: Error:Cannot resolve module 'file-loader'.
Read more >can't resolve 'file-loader' | The AI Search Engine You Control
As @silvenon said in his comment: Do you have file-loader installed? yes file-loader was installed but broken, and my issue has been solved...
Read more >sass-loader - webpack - JS.ORG
Webpack provides an advanced mechanism to resolve files. ... CSS on to the css-loader , all urls must be relative to the entry-file...
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 Free
Top 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
Yes it works !
With no file-loader at the root of my node_modules
The issue is that Encore currently builds a Webpack config that looks like this:
This config is then used by Webpack that does the resolving of
file-loader
. Node checks ifwebpack
has that dependency in itsnode_modules
folder, then at the top-level. In your case both of them are missing and it has no reason to use the one fromnode_modules/@symfony/webpack-encore/node_modules
.I tried to fix that by moving the resolving part in Encore, would you be able to test if that works for you?