<commit_before>'use strict';
var HtmlWebpackPlugin = require('html-webpack-plugin');
var fs = require('fs');

class TrlHtmlWebpackPlugin extends HtmlWebpackPlugin
{
    htmlWebpackPluginAssets(compilation, chunks) {
        let language = this.options.language;
        let ret = super.htmlWebpackPluginAssets(compilation, chunks);
        chunks.forEach(chunk => {
            chunk.files.forEach(file => {
                if (fs.existsSync(compilation.options.output.path+'/' + language + '.' + file)) {
                    ret.js.unshift(ret.publicPath + language + '.' + file);
                }
            })
        });
        return ret;
    }
}

module.exports = TrlHtmlWebpackPlugin;<commit_msg>Fix trl: Don't access filesystem, file doesn't get written when using dev-server<commit_after>'use strict';
var HtmlWebpackPlugin = require('html-webpack-plugin');
var fs = require('fs');

class TrlHtmlWebpackPlugin extends HtmlWebpackPlugin
{
    htmlWebpackPluginAssets(compilation, chunks) {
        let language = this.options.language;
        let ret = super.htmlWebpackPluginAssets(compilation, chunks);
        chunks.forEach(chunk => {
            chunk.files.forEach(file => {
                if (compilation.assets[language + '.' + file]) {
                    ret.js.unshift(ret.publicPath + language + '.' + file);
                }
            })
        });
        return ret;
    }
}

module.exports = TrlHtmlWebpackPlugin;
{'fraction_non_alphanumeric': 0.12102351313969571, 'fraction_numerical': 0.0, 'mean_word_length': 2.50363196125908, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5711070', 'n_tokens_mistral': 413, 'n_tokens_neox': 405, 'n_words': 77}