Webpack - HTML loader doens't scan all files

141 Views Asked by At

I have implemented html-loader on my Webpack configuration file:

module: {
    rules: [
        {
            test: /\.html$/i,
            exclude: /(node_modules)/,
            use: ['html-loader'],
        },
    ]
}

When I try to run webpack dev-server with the following line in index.js

import html from  `./app/components/auth/auth.html`;

it's return the following error: enter image description here

I have tried to log all the files which are scanned and it seems that Webpack doesn't even check the entire app directory in my src folder:

{
    test: (path) => {
        console.log(path)
        return /\.html$/i.test(path)
    },
    exclude: /(node_modules)/,
    use: ['html-loader'],
},

The only HTML file that was printed was index.html, which is located in the directory where webpack files are located.

My directory:

enter image description here

0

There are 0 best solutions below