Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Deprecated file-loader #298

Open
daviddavo opened this issue Feb 15, 2021 · 3 comments
Open

Deprecated file-loader #298

daviddavo opened this issue Feb 15, 2021 · 3 comments

Comments

@daviddavo
Copy link

Now It's recommended to use asset modules instead of file-loader, url-loader, etc.

https://github.com/webpack-contrib/file-loader#file-loader
https://webpack.js.org/guides/asset-modules/

@tcoopman
Copy link
Owner

You're always welcome to create a PR. I don't have the time to look into this right now.

@sanbornhilland
Copy link

I'm not sure if any changes are necessary. The following change appears to work for me:

diff --git a/config/webpack.common.js b/config/webpack.common.js
index b582cd802..081418b4c 100644
--- a/config/webpack.common.js
+++ b/config/webpack.common.js
@@ -271,7 +271,6 @@ const config = {
 
         test: /\.(png|jpg|webp|)$/i,
         use: [
-          'file-loader',
           {
             loader: 'image-webpack-loader',
             options: {
@@ -279,6 +278,7 @@ const config = {
             },
           },
         ],
+        type: 'asset/resource',
       },

@daliborfilus
Copy link

daliborfilus commented May 14, 2022

Or type: 'asset', to auto detect if the image should be inlined or not, or 'asset/inline' to always inline. See the Webpack Asset Modules docs.
This could be mentioned in the README though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants