title: typescript "Uncaught ReferenceError: require is not defined"
body: <p>guys, i have questions. How do i get filenames from a folder using typescript? I trying next way:</p>
  <ol>
  <li>I create folder and write command line &quot;tsc --init&quot; and create &quot;tsconfig.json&quot; where change options: &quot;module&quot;: &quot;es2015&quot; and &quot;target&quot;: &quot;es6&quot;.</li>
  <li>I create &quot;&quot; in html code.</li>
  <li>I create file app.ts and write code:</li>
  </ol>
  <pre><code>import * as fs from 'fs';
  
  class HTML_Element {
  public html_element: HTMLElement;
  
  constructor(html_string: string) {
      this.html_element = new HTMLElement();
      this.html_element.className = &quot;gallery_item&quot;;
      this.html_element.innerHTML = html_string;
      }
  }
  </code></pre>
  <p>const html_div: HTML_Element = new HTML_Element(&quot;FSDfdsfsd&quot;);</p>
  <p>const list_image: any = fs.readdirSync('../image/')</p>
  <p>console.log(list_image)</p>
  <p>4.I write command in terminal &quot;tsc app.ts&quot; and get &quot;app.js&quot;</p>
  <pre><code>&quot;use strict&quot;;
  exports.__esModule = true;
  var fs = require(&quot;fs&quot;);
  var HTML_Element = /** @class */ (function () {
      function HTML_Element(html_string) {
          this.html_element = new HTMLElement();
          this.html_element.className = &quot;gallery_item&quot;;
          this.html_element.innerHTML = html_string;
      }
      return HTML_Element;
  }());
  var html_div = new HTML_Element(&quot;&lt;div&gt;FSDfdsfsd&lt;/div&gt;&quot;);
  var list_image = fs.readdirSync('../image/');
  console.log(list_image);
  </code></pre>
  <p>5.I get error in the browser: Uncaught ReferenceError: require is not defined</p>