title: Getting error with webpack when using import/export
body: <p>I'm getting an error when I try to import a function from another module and then run that function. I have been doing this on simple js files, but when I tried this on TS it gives me an error. Is there a different way in TS?</p>
  <p><strong>index.ts</strong></p>
  <pre><code>import 'normalize.css';
  import './sass/style.scss';
  import * as _ from 'lodash';
  import { foo } from './ty';
  
  foo('bad');
  </code></pre>
  <p><strong>ty.ts</strong></p>
  <pre><code>const foo = (ok: string): void =&gt; {
  console.log(ok);
  };
  
  export { foo };
  </code></pre>
  <p><em>webpack.config.js</em></p>
  <pre><code>const path = require('path');
  
  module.exports = {
    entry: './src/index.ts',
    devtool: 'inline-source-map',
    mode: 'development',
    optimization: {
      usedExports: true,
    },
    module: {
      rules: [
        {
          test: /\.ts$/,
          use: 'ts-loader',
          include: [path.resolve(__dirname, 'src')],
        },
        {
          test: /\.css$/i,
          use: ['style-loader', 'css-loader'],
        },
        {
          test: /\.s[ac]ss$/i,
          use: [
            // Creates `style` nodes from JS strings
            'style-loader',
            // Translates CSS into CommonJS
            'css-loader',
            // Compiles Sass to CSS
            'sass-loader',
          ],
        },
        {
          test: /\.(woff|woff2|eot|ttf|otf)$/i,
          type: 'asset/resource',
        },
      ],
    },
    output: {
      filename: 'main.js',
      path: path.resolve(__dirname, 'dist'),
      clean: true,
    },
  };
  </code></pre>
  <p><em>tsconfig.json</em></p>
  <pre><code>  &quot;compilerOptions&quot;: {
      &quot;outDir&quot;: &quot;./dist/&quot;,
      &quot;sourceMap&quot;: true,
      &quot;noImplicitAny&quot;: true,
      &quot;module&quot;: &quot;commonJS&quot;,
      &quot;target&quot;: &quot;es5&quot;,
      &quot;jsx&quot;: &quot;react&quot;,
      &quot;allowJs&quot;: true,
      &quot;moduleResolution&quot;: &quot;node&quot;
    }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/4AOKP.png" rel="nofollow noreferrer">Here is the screenshot my VS code</a></p>