title: Import raw files from typescript with webpack using the `import` statement
body: <p>I need to import raw data from typescript using webpack.
  Here is my setup:</p>
  
  <pre><code>$ tree
  .
  +-- file.txt
  +-- main.ts
  +-- package.json
  +-- tsconfig.json
  +-- webpack.config.js
  </code></pre>
  
  <p><strong>file.txt</strong></p>
  
  <pre><code>file-content
  </code></pre>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>import file from './file.txt';
  
  console.log(file);
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
    "devDependencies": {
      "raw-loader": "^0.5.1",
      "ts-loader": "^3.1.1",
      "typescript": "^2.6.1",
      "webpack": "^3.8.1"
    }
  }
  </code></pre>
  
  <p><strong>tsconfig.json</strong></p>
  
  <pre><code>{
    "compilerOptions": {
      "outDir": "./dist/",
      "sourceMap": true,
      "noImplicitAny": true,
      "module": "commonjs",
      "target": "es5",
      "baseUrl": "app"
    },
    "exclude": [
      "node_modules"
    ]
  }
  </code></pre>
  
  <p><strong>webpack.config.js</strong></p>
  
  <pre><code>const path = require('path');
  
  const config = {
    entry: './main.ts',
    output: {
      path: path.resolve(__dirname, 'dist'),
      filename: 'app.js'
    },
    module: {
      rules: [
        { test: /\.txt$/, use: 'raw-loader' },
        { test: /\.tsx?$/, loader: 'ts-loader' },
      ]
    }
  };
  
  module.exports = config;
  </code></pre>
  
  <p>when I run weback, it says it can't find the module:</p>
  
  <pre><code>ERROR in ./main.ts
  [tsl] ERROR in /tmp/test/main.ts(1,18)
        TS2307: Cannot find module './file.txt'.
  </code></pre>
  
  <p>My question is: How can I import txt data into a typescript file? This is useful when writing an angular component, for example, and importing an html template to assign it to the template property of that component.</p>