title: Set correct path to lazy-load component using Webpack - ES6
body: <p>In my app.js file I have the following event inside a function where I import another module (same as in the docs) using the lazy-loading technique:</p>
  
  <pre><code>button.onclick = e =&gt; import(/* webpackChunkName: "print" */ './print').then(module =&gt; {
      var print = module.default;
  
      print();
  });
  </code></pre>
  
  <p>And in my webpack config I set up this (besides Babel, SASS loaders, etc):</p>
  
  <pre><code>const path = require('path');
  var ExtractTextPlugin = require('extract-text-webpack-plugin');
  const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
  
  module.exports = {
  watch: true,
  entry: {
      main: ['babel-polyfill', './src/js/app.js','./src/sass/main.sass']
  },
  output: {
      chunkFilename: '[name].bundle.js',
      path: path.resolve(__dirname, "dist"),
      filename: '[name].js',
  
  },
  module: {
      rules: [
          {
              test: /\.js$/,
              exclude: /node_modules/,
              use: {
                  loader: 'babel-loader',
                  options: {
                      presets: ["babel-preset-env", "babel-preset-stage-0"]
                  }
              }
          },
          {
              test: /\.sass$/,
              exclude: /node_modules/,
              use: ExtractTextPlugin.extract({
                  fallback: 'style-loader',
                  use: [
                      'css-loader',
                      {
                          loader: 'sass-loader',
                          query: {
                              sourceMap: false,
                          },
                      },
                  ],
              }),
          },
      ]
    }    
  }
  </code></pre>
  
  <p>The problem is the path "./print" is from my "src" folder and not from my  "dist" folder, where webpack puts all the bundles, so I get a 404 error. If I change the path to "./dist/print" then the webpack build will crash.</p>
  
  <p>Am I missing a  webpack configuration?</p>
  
  <p>Edit:
  Folder structure:</p>
  
  <pre><code>src 
      js
          app.js
          print.js
  dist
      main.bundle.js
      print.bundle.js
  </code></pre>