webdiscus / pug-loader

Pug loader for Webpack renders pug to HTML or template function
https://webdiscus.github.io/pug-loader/pug-filters
ISC License
72 stars 5 forks source link

hello-world-app does not compile #24

Closed bkwdesign closed 1 year ago

bkwdesign commented 1 year ago

Steps to reproduce:

1.) use git to clone /webdiscus/pug-loader/ 2.) opened VS Code to this folder: /pug-loader/blob/master/examples/hello-world-app/

  1. Run npm i
  2. Run npm run build

Output:

> app-hello-world@1.0.0 build
> webpack --mode=production --progress

2 assets
23 modules

ERROR in ./src/assets/images/app-logo.svg 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <?xml version="1.0" encoding="iso-8859-1"?>
| <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
| <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"

ERROR in ./src/assets/images/demo.jpeg 1:0
Module parse failed: Unexpected character 'ļæ½' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)

ERROR in ./src/assets/images/favicons/favicon-32px.png 1:0
Module parse failed: Unexpected character 'ļæ½' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)

ERROR in ./src/assets/images/favicons/favicon.svg 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <?xml version="1.0" encoding="utf-8"?>
| <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
| <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"

ERROR in [entry] [initial]
[pug-plugin] Can't resolve the file C:/Users/***/source/pug-loader/examples/hello-world-app/src/assets/images/favicons/favicon.svg in C:\Users\***\source\pug-loader\examples\hello-world-app\src\views\pages\home\index.pug

Is this happening because I'm on a Windows 10 machine?

webdiscus commented 1 year ago

@bkwdesign

thanks for bug report. I will fix it for Windows.

On linux/macos works fine.

webdiscus commented 1 year ago

@bkwdesign

I fixed the resource path in the Webpack config because on Windows the slash in the path is different:

include: /assets/images/ -> include: /assets[\\/]images/

Try please updated example from GitHub.

bkwdesign commented 1 year ago

npm run build

app-hello-world@1.0.0 build webpack --mode=production --progress

13 assets 24 modules webpack 5.74.0 compiled successfully in 1279 ms

šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘ Thank You!!