Cognizant-CDE-Australia / generator-confit

Build-tool generator for current and future web.
https://odecee.github.io/generator-confit
Other
29 stars 3 forks source link

Sample demo app does not match with the input extension for HTML files #105

Closed motevallian closed 7 years ago

motevallian commented 7 years ago

During generating an app using confit, if I select .htm for the extension of my html files, then I request a sample app to be generated, any command trying to run Webpack will fail. For example when I try to bundle the app I get this:

[7] ./modules/demoModule/template/page1.html 252 bytes {0} [built] [failed] [1 error]
   [8] ./modules/demoModule/template/page2.html 320 bytes {0} [built] [failed] [1 error]
   [9] multi sampleApp 28 bytes {0} [built]
  [10] multi vendor 40 bytes {1} [built]
    + 7 hidden modules

ERROR in ./modules/demoModule/template/page1.html
Module parse failed: /Users/alireza/dev/confit/src/modules/demoModule/template/page1.html Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <div class="page1">
|   <h1>This is page 1</h1>
| 
 @ ./modules/demoModule/app.js 14:14-46
 @ multi sampleApp

ERROR in ./modules/demoModule/template/page2.html
Module parse failed: /Users/alireza/dev/confit/src/modules/demoModule/template/page2.html Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <div class="page2">
|   <h2>This is page 2</h2>
|   <a href="#/page1" class="btn icon icon-menu-expand">Page 1</a>
 @ ./modules/demoModule/app.js 16:14-46
 @ multi sampleApp

As I have a bit of experience with Webpack I knew the html-loader is not picking up those files and could immediately look and fix it but I am sure it will take sometime for a newbie to figure out why the sample app does not work (Remember page1 and page2 have their extension hardcoded as .html). I recommend changing the type of those file according to the Confit configs.

uglow commented 7 years ago

Good pickup @motevallian . Do you think we need to even offer this choice anymore? I'm thinking we default it to ".html" and maybe set the loader test to \.html?. That will find files that end in .htm and .html.

uglow commented 7 years ago

@motevallian thoughts (see above)?

motevallian commented 7 years ago

I think the thing that matters is to be consistent, if we give a choice to the user, he expects his selection to be reflected eveywhere. So, if he is able to enter anything, we should add that very same string to the loader config. Otherwise, making it to choose between htm and html is also fine.

uglow commented 7 years ago

Thanks @motevallian. I'll fix this by removing the choice in the UI and making the config support .htm and .html