pcardune / handlebars-loader

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

Module not found error #80

Open abhisekp opened 8 years ago

abhisekp commented 8 years ago

I'm using handlebars-loader and I get this error from the peer dependency handlebars package. I don't understand what I'm doing wrong and why I see the error.

ERROR in ./~/handlebars/runtime.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./dist/cjs/handlebars.runtime in /home/abhisekp/MyProjects/JSApps/MadeWithLove-Webpack/node_modules/handlebars
 @ ./~/handlebars/runtime.js 3:17-57

My package.json

"dependencies":{  
  "handlebars":"^4.0.5"
},
"devDependencies":{  
  "babel-core":"^6.4.5",
  "babel-loader":"^6.2.1",
  "babel-preset-es2015":"^6.3.13",
  "handlebars-loader":"^1.1.4",
  "webpack":"^1.12.12"
}

My webpack.config.js

{
  test: /\.h(andle)?b(ar)?s$/i,
  loader: 'handlebars'
}

My Components/Button.js

import btnTempl from './Button.hbs';

Here is the related error: https://github.com/wycats/handlebars.js/issues/1174

milewski commented 7 years ago

this is probably because you are not allowing webpack to resolve .js files

resolve: {
  extensions: ['.ts', '.tsx', '.js'], //dont forget to set .js
},