title: Webpack: You may need an appropriate loader to handle this file
body: <p>I am setting up typescript with webpack, using <code>awesome-typescript-loader</code>. However webpack is giving me this error on build:</p>
  
  <blockquote>
    <p>ERROR in ./src/logic/Something.ts </p>
    
    <p>Module parse failed: Unexpected
    token (2:19) You may need an appropriate loader to handle this file
    type.</p>
  </blockquote>
  
  <p>here is a piece of code from <code>webpack.config.js</code>:</p>
  
  <pre><code>module: {
          loaders: [
              {
                  test: /\.(js|jsx)?$/,
                  loader: "babel-loader",
                  exclude: /node_modules/
              },
              {
                  test: /\.(ts|tsx)?$/,
                  loader: "awesome-typescript-loader",
                  exclude: /node_modules/
              },
              {
                  test: /\.(css|less)?$/,
                  use: [{
                      loader: "style-loader"
                  }, {
                      loader: "css-loader?modules&amp;localIdentName=[local]--[hash:base64:5]"
                  }, {
                      loader: "less-loader"
                  }]
              },
              {
                  test: /\.json$/,
                  exclude: /node_modules/,
                  loader: 'json-loader'
              }
          ]
      },
      resolve: {
          extensions: [".js", ".jsx", ".ts", ".tsx", ".css", ".less"]
      }
  </code></pre>
  
  <p>and <code>tsconfig.json</code>:</p>
  
  <pre><code>{
    "compilerOptions": {
      "noImplicitAny": false,
      "noEmitOnError": true,
      "module": "commonjs",
      "removeComments": false,
      "sourceMap": true,
      "target": "es5",
      "jsx":  "react" 
    },
    "exclude": [
      "node_modules",
      "wwwroot"
    ]
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p><code>Something.ts</code> file:</p>
  
  <pre><code>class Something {
      constructor(str: string) {
          console.log(str);
      }
  }
  
  export { Something };
  </code></pre>
  
  <p>Do you have any ideas where the issue might be? Thanks!</p>