Prevent webpack 4 pug loader from compiling mixin files

101
January 10, 2020, at 6:50 PM

I'm really new to Webpack 4 and found a configuration issue I can not resolve.

I'm configuring Webpack for a multi page application. HTML template engine is PUG. Files are compiled correctly, but when I create the bundle, Webpack is also compiling the mixins I have at "src/pug/mixins" folders. Therefore I get an .html file from every .pug mixin file I have.

How can I tell Webpack not to generate an .html file from a mixins located inside a folder?

I have the following at my webpack.config file:

module: {
      rules: [
        {
            test: /\.pug$/,
            use: ["pug-loader"],
            exclude: [path.resolve(__dirname, 'src/pug/utils')]
        },

However, all mixins inside utils folder are converted (i.e: utils/coreMixins.pug -> utils/coreMixins.html )

Thanks for your answers

READ ALSO
Node.js scraping with the request module

Node.js scraping with the request module

I want to get html from a webBut it show like that

73
Is it possible to lazy load a set of components/modules in React from a url?

Is it possible to lazy load a set of components/modules in React from a url?

I have a React application that I'm building that will support 3rd party developers writing their own components that we will test and then host on our company CDNI have dynamic loading of modules working using @loadable/component, but I can't figure...

88
Heroku error module not found 'json-server'

Heroku error module not found 'json-server'

I want to deploy my server on Heroku, but on Heroku build it says this:

107