'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;

'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;

Fix trl: Don't access filesystem, file doesn't get written when using dev-server
Fix trl: Don't access filesystem, file doesn't get written when using dev-server
