Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JacobWay/bab9ce287163bd5979d69af094c5f82a to your computer and use it in GitHub Desktop.
Save JacobWay/bab9ce287163bd5979d69af094c5f82a to your computer and use it in GitHub Desktop.
multiple applications on one front end project, webpack, html-webpack-plugin

webpack

module.exports = {
  entry: {
    'app1': 'path/to/app1',
    'app2': 'path/to/app2'
  },
  output: {
    path: 'your/local/file/path',
    filename: 'subdirectory/[name].js'
  },
  
  plugins: [
    new HtmlWebpackPlugin({
      template: 'your/template/file/path',
      filename: 'generated/html/file/path',
      chuncks: ['app1'] // the injected files from the entry.
      inject: true
    }),
    new HtmlWebpackPlugin({
      template: 'your/template/file/path',
      filename: 'generated/html/file/path',
      chuncks: ['app2'] // the injected files from the entry.
      inject: true
    })
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment