dc7290 / template-ejs-loader

ejs-loader with webpack5 support. Chain it to html-loader and use it with html-webpack-plugin.
MIT License
24 stars 3 forks source link

html-loader Options error #19

Closed florent-cdl closed 2 years ago

florent-cdl commented 2 years ago

Describe the bug When I try to add options to htmlloader I've got an error

To Reproduce I've created a repository to test https://github.com/florent-cdl/ejs-webpack-sample

added those lines

    htmlLoaderOption:{
      // set individual html-loader option here
      sources: false
    },

but got the compilation error : - options.sources should be one of these: boolean | object { list?, urlFilter? }

Expected behavior It seems that boolean values are not recognized. Also, I've tried an object but same pb. I've also tried to put options in module rules loader config :

      {
        loader: 'html-loader',
        options: {
            sources: false,
       },
      },

One more thing, I've added the 'root' option in templateEjsLoaderOption but the path is added to the current path and with quotes : (./src/assets/components is the root option value, even tried with path.resolve(__dirname, './src/assets/components')) ENOENT: no such file or directory, open '/Volumes/TRAVAUX/PROJETS/TEST-WEBPACK/"./src/assets/components"/Volumes/TRAV AUX/PROJETS/TEST-WEBPACK/src/bundles/ejs/pages/about-us.ejs'

Thank you Best regards

mizok commented 2 years ago

Boolean values here are parsed as String incorrectly : (

Seems to be kinda QueryString problem that I didn't notice (because we switched to URLSearchParams), I will see what I could do tonight.

mizok commented 2 years ago

@florent-cdl In case you are in a hurry. The second problem you mentioned can be easily fixed by upgrading to v0.8.0.

florent-cdl commented 2 years ago

You're right I'm quite hurry :) And thank you for being so quick !

I'm going to try the 0.8 right now

Best regards

mizok commented 2 years ago

@dc7290

Maybe you will be interested in this. I reported the function type issue to webpack devs.

https://github.com/webpack/webpack/discussions/15362#discussioncomment-2150138