title: Webpack + Handlebars custom helper - require.extension not supported
body: <p>So I have this little helper for text truncating</p>
  
  <pre><code>'use strict';
  var Handlebars = require('handlebars');
  
  module.exports = function truncate(str, len, words) {
    var safe = Handlebars.Utils.escapeExpression(str);
    var tooLong = safe.length &gt; len;
    var s_ = tooLong ? safe.substr(0, len) : safe;
    if (words &amp;&amp; tooLong) {
      var index = s_.lastIndexOf(' ');
      if (index !== -1) {
        s_ = s_.substr(0, index);
      }
    }
    return  new Handlebars.SafeString(tooLong ? s_ + ' &amp;hellip;' : s_);
  };
  </code></pre>
  
  <p>which throws three warnings in the console during compiling (but the output works as expected)</p>
  
  <pre><code>WARNING in ./node_modules/handlebars/lib/index.js 22:38-56
  require.extensions is not supported by webpack. Use a loader instead.
  
  WARNING in ./node_modules/handlebars/lib/index.js 23:2-20
  require.extensions is not supported by webpack. Use a loader instead.
  
  WARNING in ./node_modules/handlebars/lib/index.js 24:2-20
  require.extensions is not supported by webpack. Use a loader instead.
  </code></pre>
  
  <p>I googled and found I have to import handlebars in the helper in different way</p>
  
  <pre><code>import * as Handlebars from 'handlebars/dist/cjs/handlebars';
  </code></pre>
  
  <p>but this is much worse and throws errors</p>
  
  <pre><code>ERROR in Template execution failed: TypeError: Cannot assign to read only property 'exports' of object '#&lt;Object&gt;'
  
  ERROR in   TypeError: Cannot assign to read only property 'exports' of object '#&lt;Object&gt;'
  </code></pre>
  
  <p>So what's the right way to include handlebars for helpers. Or better way - how to include handlebars in webpack globally for all helpers which are using eg. <code>Handlebars.Utils</code></p>