<commit_before>const BundleTracker = require('webpack-bundle-tracker');
const path = require('path');
const webpack = require('webpack');

/*** helpers ***/

const devMode = process.env.NODE_ENV !== 'production';

// BundleTracker includes absolute paths, which causes webpack-stats.json to change when it shouldn't.
// We use this RelativeBundleTracker workaround via https://github.com/owais/webpack-bundle-tracker/issues/25
const RelativeBundleTracker = function(options) {
  BundleTracker.call(this, options);
};
RelativeBundleTracker.prototype = Object.create(BundleTracker.prototype);
RelativeBundleTracker.prototype.writeOutput = function(compiler, contents) {
  if(contents.chunks){
    const relativePathRoot = path.join(__dirname) + path.sep;
    for(const bundle of Object.values(contents.chunks)){
      for(const chunk of bundle){
        if (chunk.path.startsWith(relativePathRoot)) {
          chunk.path = chunk.path.substr(relativePathRoot.length);
        }
      }
    }
  }
  BundleTracker.prototype.writeOutput.call(this, compiler, contents);
};

/*** Vue config ***/
let devServerHost = process.env.DOCKERIZED ? '0.0.0.0' : '127.0.0.1';

let vueConfig = {
  outputDir: 'static/dist',

  // When running `npm run serve`, paths in webpack-stats.json will point to the live dev server.
  // Otherwise they will point to the compiled assets URL.
  publicPath: devMode ? 'http://localhost:8080/static/dist' : '/static/dist',

  pages: {
    application: 'frontend/pages/application.js',
    rich_text_editor: 'frontend/pages/rich_text_editor.js',
    main: 'frontend/pages/main.scss',
    test: 'frontend/pages/test.js',
    vue_app: 'frontend/pages/vue_app.js',
  },

  configureWebpack: {
    plugins: devMode ? [] : [new RelativeBundleTracker({filename: './webpack-stats.json'})] + [   // output location of bundles so they can be found by django
      new webpack.ProvidePlugin({
        $: 'jquery',
        jQuery: 'jquery'
      }),
    ],
    resolve: {
      alias: {
        '@': path.resolve("frontend"),
        vue: "vue/dist/vue.esm.js",
        'vue$': 'vue/dist/vue.esm.js',
        // alias assets dir to ~assets for SASS url() styles
        static: path.resolve("static"),
      },
      modules: [
        path.resolve('frontend'),
        path.resolve('frontend', 'styles'),
        'node_modules'
      ],
    }
  },

  devServer: {
    public: devServerHost + ':8080',
    host: devServerHost,<commit_msg>Slightly redundant adjustment<commit_after>const BundleTracker = require('webpack-bundle-tracker');
const path = require('path');
const webpack = require('webpack');

/*** helpers ***/

const devMode = process.env.NODE_ENV !== 'production';

// BundleTracker includes absolute paths, which causes webpack-stats.json to change when it shouldn't.
// We use this RelativeBundleTracker workaround via https://github.com/owais/webpack-bundle-tracker/issues/25
const RelativeBundleTracker = function(options) {
  BundleTracker.call(this, options);
};
RelativeBundleTracker.prototype = Object.create(BundleTracker.prototype);
RelativeBundleTracker.prototype.writeOutput = function(compiler, contents) {
  if(contents.chunks){
    const relativePathRoot = path.join(__dirname) + path.sep;
    for(const bundle of Object.values(contents.chunks)){
      for(const chunk of bundle){
        if (chunk.path.startsWith(relativePathRoot)) {
          chunk.path = chunk.path.substr(relativePathRoot.length);
        }
      }
    }
  }
  BundleTracker.prototype.writeOutput.call(this, compiler, contents);
};

/*** Vue config ***/
let devServerHost = process.env.DOCKERIZED ? '0.0.0.0' : '127.0.0.1';

let vueConfig = {
  outputDir: 'static/dist',

  // When running `npm run serve`, paths in webpack-stats.json will point to the live dev server.
  // Otherwise they will point to the compiled assets URL.
  publicPath: devMode ? 'http://localhost:8080/static/dist' : '/static/dist',

  pages: {
    application: 'frontend/pages/application.js',
    rich_text_editor: 'frontend/pages/rich_text_editor.js',
    main: 'frontend/pages/main.scss',
    test: 'frontend/pages/test.js',
    vue_app: 'frontend/pages/vue_app.js',
  },

  configureWebpack: {
    plugins: process.env.NODE_ENV === 'test' ? [new webpack.ProvidePlugin({
        $: 'jquery',
        jQuery: 'jquery'
      }),] : [
      new RelativeBundleTracker({   // output location of bundles so they can be found by django
        filename: './webpack-stats.json'}),
      new webpack.ProvidePlugin({
        $: 'jquery',
        jQuery: 'jquery'
      }),
    ],
    resolve: {
      alias: {
        '@': path.resolve("frontend"),
        vue: "vue/dist/vue.esm.js",
        'vue$': 'vue/dist/vue.esm.js',
        // alias assets dir to ~assets for SASS url() styles
        static: path.resolve("static"),
      },
      modules: [
        path.resolve('frontend'),
        path.resolve('frontend', 'styles'),
        'node_modules'
      ],
    }
  },

  devServer: {
    public: devServerHost + ':8080',
    host: devServerHost,
{'fraction_non_alphanumeric': 0.14388059701492537, 'fraction_numerical': 0.007960199004975124, 'mean_word_length': 3.216442953020134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '3670352', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1512, 'n_words': 336}