title: Webpack tree shaking still bundles unused exports
body: <p>I am trying to test out Webpack's tree shaking feature, but it does not appear to be working.</p>
  
  <p>Here are my files:</p>
  
  <ul>
  <li><code>index.ts</code></li>
  </ul>
  
  <pre><code>import { good } from './exports';
  console.log(good);
  </code></pre>
  
  <ul>
  <li><code>exports.ts</code></li>
  </ul>
  
  <pre><code>export const good = 'good';
  export const secret = 'iamasecret';
  </code></pre>
  
  <ul>
  <li><code>tsconfig.json</code></li>
  </ul>
  
  <pre><code>{}
  </code></pre>
  
  <ul>
  <li><code>webpack.config.ts</code></li>
  </ul>
  
  <pre><code>import { Configuration } from 'webpack';
  import  * as TerserPlugin from "terser-webpack-plugin";
  const config: Configuration = {
      mode: 'production',
      entry: './index.ts',
      module: {
          rules: [
            {
              test: /\.tsx?$/,
              use: 'ts-loader',
              exclude: /node_modules/,
            },
          ],
        },
        resolve: {
          extensions: [ '.tsx', '.ts', '.js' ]
        },
        optimization: {
          usedExports: true,
          minimizer: [new TerserPlugin()],
        }
  }
  export default config;
  </code></pre>
  
  <ul>
  <li><code>package.json</code></li>
  </ul>
  
  <pre><code>{
    "name": "webpacktest",
    "version": "1.0.0",
    "description": "",
    "main": "index.ts",
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1"
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
      "@types/terser-webpack-plugin": "^2.2.0",
      "@types/webpack": "^4.41.11",
      "terser-webpack-plugin": "^2.3.5",
      "ts-loader": "^7.0.0",
      "ts-node": "^8.8.2",
      "typescript": "^3.8.3",
      "webpack": "^4.42.1",
      "webpack-cli": "^3.3.11"
    },
    "sideEffects": false
  }
  </code></pre>
  
  <p>When I run <code>npx webpack</code> it bundles the files into <code>dist/main.js</code>. When I open that file, the secret string is in there despite it being an unused export. Is there a way that I can stop it from being included in the final bundle?</p>