<commit_before>const path = require('path');
const ls = require('ls');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const plugins = [];
const entry = {};

const filenamePrefix = process.env.DEV_SERVER ? 'contribs/gmf/apps/' : '';

for (const filename of ls('contribs/gmf/apps/*/index.html')) {
  const name = path.basename(filename.path);
  entry[name] = `./${filename.path}/js/Controller.js`;
  plugins.push(
    new HtmlWebpackPlugin({
      template: filename.full,
      chunksSortMode: 'manual',
      filename: filenamePrefix + name + '/index.html',
      chunks: ['commons', name]
    })
  );
}

module.exports = {
  entry: entry,
  optimization: {
    splitChunks: {
      chunks: 'all',
      name: 'commons',
    }
  },
  plugins: plugins,
};

if (!process.env.DEV_SERVER) {
  Object.assign(module.exports, {
    output: {
      path: path.resolve(__dirname, '../.build/contribs-gmf-apps'),
    },
  });
}<commit_msg>Build gmf apps directly into examples-hosted directory<commit_after>const path = require('path');
const ls = require('ls');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const plugins = [];
const entry = {};

const filenamePrefix = process.env.DEV_SERVER ? 'contribs/gmf/apps/' : '';

for (const filename of ls('contribs/gmf/apps/*/index.html')) {
  const name = path.basename(filename.path);
  entry[name] = `./${filename.path}/js/Controller.js`;
  plugins.push(
    new HtmlWebpackPlugin({
      template: filename.full,
      chunksSortMode: 'manual',
      filename: filenamePrefix + name + '/index.html',
      chunks: ['commons', name]
    })
  );
}

module.exports = {
  entry: entry,
  optimization: {
    splitChunks: {
      chunks: 'all',
      name: 'commons',
    }
  },
  plugins: plugins,
};

if (!process.env.DEV_SERVER) {
  Object.assign(module.exports, {
    output: {
      path: path.resolve(__dirname, '../.build/examples-hosted/contribs/gmf/apps'),
    },
  });
}
{'fraction_non_alphanumeric': 0.17255096966683242, 'fraction_numerical': 0.0, 'mean_word_length': 3.4317180616740086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4013195', 'n_tokens_mistral': 657, 'n_tokens_neox': 656, 'n_words': 130}