title: Node JS and Webpack Unexpected token <
body: <p>I've started studing <em>Node JS</em>.</p>
  
  <p>So here is my files.</p>
  
  <p><strong><em>index.html</em></strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="app"&gt;
      &lt;h1&gt;Hello&lt;h1&gt;
    &lt;/div&gt;
    &lt;script src='assets/bundle.js'&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong><em>app.js</em></strong></p>
  
  <pre><code>var http = require("http"),
      path = require('path')
      fs = require("fs"),
      colors = require('colors'),
      port = 3000;
  
  var Server = http.createServer(function(request, response) {
    var filename = path.join(__dirname, 'index.html');
  
    fs.readFile(filename, function(err, file) {
      if(err) {        
        response.writeHead(500, {"Content-Type": "text/plain"});
        response.write(err + "\n");
        response.end();
        return;
      }
  
      response.writeHead(200);
      response.write(file);
      response.end();
    });
  });
  
  Server.listen(port, function() {
    console.log(('Server is running on http://localhost:'+ port + '...').cyan);
  </code></pre>
  
  <p><strong><em>webpack.config.js</em></strong></p>
  
  <pre><code>module.exports = {
      entry: './src/index.js',
      output: {
          path: __dirname + '/assets',
          filename: 'bundle.js'
      }
  }
  </code></pre>
  
  <p><strong><em>UPDATE</em></strong>
  <strong><em>bundle.js</em></strong></p>
  
  <pre><code>/******/ (function(modules) { // webpackBootstrap
  /******/    // The module cache
  /******/    var installedModules = {};
  
  /******/    // The require function
  /******/    function __webpack_require__(moduleId) {
  
  /******/        // Check if module is in cache
  /******/        if(installedModules[moduleId])
  /******/            return installedModules[moduleId].exports;
  
  /******/        // Create a new module (and put it into the cache)
  /******/        var module = installedModules[moduleId] = {
  /******/            exports: {},
  /******/            id: moduleId,
  /******/            loaded: false
  /******/        };
  
  /******/        // Execute the module function
  /******/        modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  
  /******/        // Flag the module as loaded
  /******/        module.loaded = true;
  
  /******/        // Return the exports of the module
  /******/        return module.exports;
  /******/    }
  
  
  /******/    // expose the modules object (__webpack_modules__)
  /******/    __webpack_require__.m = modules;
  
  /******/    // expose the module cache
  /******/    __webpack_require__.c = installedModules;
  
  /******/    // __webpack_public_path__
  /******/    __webpack_require__.p = "";
  
  /******/    // Load entry module and return exports
  /******/    return __webpack_require__(0);
  /******/ })
  /************************************************************************/
  /******/ ([
  /* 0 */
  /***/ function(module, exports) {
  
      alert('Hello');
  
  /***/ }
  /******/ ]);
  </code></pre>
  
  <p>So, when i  hit a <em>app.js</em> and visit the address (localhost:3000) i get the error in console.</p>
  
  <blockquote>
    <p>bundle.js:1 Uncaught SyntaxError: Unexpected token &lt;</p>
  </blockquote>
  
  <p>Also my JS file doesnt run.
  Could someone suggest something to fix it?</p>
  
  <p>Thanks in advance</p>