pcardune / handlebars-loader

A handlebars template loader for webpack
551 stars 168 forks source link

Unexpected character '#' #144

Open Mssol94 opened 6 years ago

Mssol94 commented 6 years ago

I'm currently having a problem with handlebars-loader.

ERROR in ./js/myTemplate.hbs
Module parse failed: D:\Mine Dokumenter\Google Drive\Web\Valgportal\js\myTemplate.hbs Unexpected character '#' (1:2)
You may need an appropriate loader to handle this file type.
| {{#each pets}}
|   <div class="pet">
|     <div class="photo-column">
 @ ./js/main.js 1:17-44
 @ multi (webpack)-dev-server/client?http://localhost:8081 ./js/main.js ./index.js
const path = require("path");

module.exports = {
    entry: "./js/main.js",
    output: {
      path: path.resolve(__dirname, "./js"),
      filename: "main-bundled.js"
    },
    module: {
        loaders: [
            {test: /\.hbs$/, loader: 'handlebars-loader'}
        ]
      },
    module: {
        loaders: [
            { test:/\.css$/, loader: 'style-loader!css-loader' }
        ]
    }
}
{
  "name": "valgportal",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "webpack-dev-server ./index.js"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "css-loader": "^0.28.7",
    "handlebars": "^4.0.10",
    "handlebars-loader": "^1.6.0",
    "handlebars-template-loader": "^0.8.0",
    "path": "^0.12.7",
    "style-loader": "^0.18.2",
    "webpack": "^3.5.5",
    "webpack-dev-server": "^2.7.1"
  },
  "dependencies": {
    "jquery": "^3.2.1"
  }
}
mAAdhaTTah commented 6 years ago

You have module and loaders twice in the object, so only the second value of that key gets assigned to the exported object, so the handlebars loader isn't actually in ur webpack config.