<commit_before>'use strict';
const webpack = require('webpack');
const path = require('path');
const fs = require("fs");
const ini = require('ini');

const ExtractTextPlugin = require("extract-text-webpack-plugin");
const WebpackConfig = require('webpack-config');
const BowerResolvePlugin = require("bower-resolve-webpack-plugin");
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

const loadTranslations = require('../trl/load-translations');
const lookupSassIncludePaths = require('../loader/lookup-sass-include-paths');
const lookupAliasPaths = require('../loader/lookup-alias-paths');
const TrlPlugin = require("../trl/trl-plugin");
const fetchLanguages = require("../loader/fetch-languages");
const fetchKwfConfig = require("./fetch-kwf-config");

var extractCssPlugin = new ExtractTextPlugin("./[name].css");
const kwfConfig = fetchKwfConfig();

const langauges = fetchLanguages();

const configIni = ini.parse(fs.readFileSync('config.ini', 'utf-8'));
const webCodeLangauge = configIni.production.webCodeLanguage;
const uniquePrefix = configIni.production['application.uniquePrefix'];

let plugins = [
    new UglifyJSPlugin(),
    new TrlPlugin({
        languages: langauges,
        webCodeLanguage: webCodeLangauge,
        translations: {
            web: loadTranslations(['../trl/[language].po'], langauges),
            kwf: loadTranslations(['../vendor/koala-framework/koala-framework/trl/[language].po'], langauges),
        }
    }),
    extractCssPlugin,
    /*
     new webpack.ResolverPlugin([
     new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin(".bower.json", ["main"])
     ], ['normal']),
     */
];

//console.log(WebpackConfig.environment);
//console.log(WebpackConfig.Config);

module.exports = {
    //devtool: "source-map", // or "inline-source-map"
    output: {
        //path: __dirname + "/build/assets",
        path: process.cwd()+"/build/assets",
        publicPath: "http://"+kwfConfig['webpack-dev-server-host']+':'+kwfConfig['webpack-dev-server-port']+"/assets/build/",
        filename: '[name].js',
        chunkFilename: "[id].js",
        //pathinfo: true //Include comments with information about the modules
    },
    module: {
        rules: [{
            rules: [{
                test: /\.underscore\.tpl$/,
                loader: "underscore-template-loader",
                options: {
                    engine: 'underscore'
                }
            },{
                enforce: 'post',
                test: /\.s?css$/,
                loader: extractCssPlugin.extract({
                    use: "css-loader",
                    fallback: "style-loader"
                })
            },{
                enforce: 'post',
                test: /\.s?css$/,
                loader: "postcss-loader",
                options: {
                    plugins: function() {
                        return [
                            require('autoprefixer')({
                                browsers: '> 0.05%',
                                remove: true,
                                add: true
                            })
                        ];
                    }
                }
            },{
                enforce: 'post',
                test: /\.(s?css|underscore\.tpl|jsx?)$/,
                loader: path.resolve(__dirname, "../loader/kwfup-loader")+"?uniquePrefix="+uniquePrefix,
            },{
                enforce: 'post',
                test: /vendor\/koala-framework\/extjs2\/.*\.css$/,
                loader: require.resolve('../loader/ext2-css-loader')

            },{
                enforce: 'post',
                test: /\.scss$/,
                loader: "sass-loader",
                options: {
                    includePaths: lookupSassIncludePaths(),
                    data: "@import \"config/global-settings\";"
                }
/*
            },{
                enforce: 'post',
                test: /\.scss$/,
                use: [{
                    loader:  require.resolve('../loader/caching-loader') //to avoid same scss getting built twice when extractCssPlugin is used
                }, {
                    loader: "sass-loader",
                    options: {
                        includePaths: lookupSassIncludePaths(),
                        data: "@import \"config/global-settings\";"
                    }
                }]
*/
            }],
        }],
        loaders: [
            /*
             {
             test: /\.js$/,
             exclude: /node_modules/,
             //babel-loader macht "use strict"; was uns stört, darum erstmal deaktiviert
             //TODO überlegen wo/wie der aktiviert werden soll
             loader: "babel-loader"//!./webpack-loader/kwfup-loader?uniquePrefix=webpackbuild"
             },
             */
        ]
    },
    resolve: {
        modules: ["node_modules", "vendor/bower_components"],
        descriptionFiles: ['bower.json', 'package.json'],
        mainFields: ['main', 'browser'],
        plugins: [new BowerResolvePlugin()],
        alias: lookupAliasPaths(),
    },
    resolveLoader: {
        modules: ["node_modules", "vendor/koala-framework/koala-framework/node_modules_add"]
    },
    stats: {
        children: false
    },
    plugins: plugins
};<commit_msg>Add proxy for devserver to make fonts and background iamges work<commit_after>'use strict';
const webpack = require('webpack');
const path = require('path');
const fs = require("fs");
const ini = require('ini');

const ExtractTextPlugin = require("extract-text-webpack-plugin");
const WebpackConfig = require('webpack-config');
const BowerResolvePlugin = require("bower-resolve-webpack-plugin");
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

const loadTranslations = require('../trl/load-translations');
const lookupSassIncludePaths = require('../loader/lookup-sass-include-paths');
const lookupAliasPaths = require('../loader/lookup-alias-paths');
const TrlPlugin = require("../trl/trl-plugin");
const fetchLanguages = require("../loader/fetch-languages");
const fetchKwfConfig = require("./fetch-kwf-config");

var extractCssPlugin = new ExtractTextPlugin("./[name].css");
const kwfConfig = fetchKwfConfig();

const langauges = fetchLanguages();

const configIni = ini.parse(fs.readFileSync('config.ini', 'utf-8'));
const webCodeLangauge = configIni.production.webCodeLanguage;
const uniquePrefix = configIni.production['application.uniquePrefix'];

let plugins = [
    new UglifyJSPlugin(),
    new TrlPlugin({
        languages: langauges,
        webCodeLanguage: webCodeLangauge,
        translations: {
            web: loadTranslations(['../trl/[language].po'], langauges),
            kwf: loadTranslations(['../vendor/koala-framework/koala-framework/trl/[language].po'], langauges),
        }
    }),
    extractCssPlugin,
    /*
     new webpack.ResolverPlugin([
     new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin(".bower.json", ["main"])
     ], ['normal']),
     */
];

//console.log(WebpackConfig.environment);
//console.log(WebpackConfig.Config);

module.exports = {
    //devtool: "source-map", // or "inline-source-map"
    output: {
        //path: __dirname + "/build/assets",
        path: process.cwd()+"/build/assets",
        publicPath: "http://"+kwfConfig['webpack-dev-server-host']+':'+kwfConfig['webpack-dev-server-port']+"/assets/build/",
        filename: '[name].js',
        chunkFilename: "[id].js",
        //pathinfo: true //Include comments with information about the modules
    },
    module: {
        rules: [{
            rules: [{
                test: /\.underscore\.tpl$/,
                loader: "underscore-template-loader",
                options: {
                    engine: 'underscore'
                }
            },{
                enforce: 'post',
                test: /\.s?css$/,
                loader: extractCssPlugin.extract({
                    use: "css-loader",
                    fallback: "style-loader"
                })
            },{
                enforce: 'post',
                test: /\.s?css$/,
                loader: "postcss-loader",
                options: {
                    plugins: function() {
                        return [
                            require('autoprefixer')({
                                browsers: '> 0.05%',
                                remove: true,
                                add: true
                            })
                        ];
                    }
                }
            },{
                enforce: 'post',
                test: /\.(s?css|underscore\.tpl|jsx?)$/,
                loader: path.resolve(__dirname, "../loader/kwfup-loader")+"?uniquePrefix="+uniquePrefix,
            },{
                enforce: 'post',
                test: /vendor\/koala-framework\/extjs2\/.*\.css$/,
                loader: require.resolve('../loader/ext2-css-loader')

            },{
                enforce: 'post',
                test: /\.scss$/,
                loader: "sass-loader",
                options: {
                    includePaths: lookupSassIncludePaths(),
                    data: "@import \"config/global-settings\";"
                }
/*
            },{
                enforce: 'post',
                test: /\.scss$/,
                use: [{
                    loader:  require.resolve('../loader/caching-loader') //to avoid same scss getting built twice when extractCssPlugin is used
                }, {
                    loader: "sass-loader",
                    options: {
                        includePaths: lookupSassIncludePaths(),
                        data: "@import \"config/global-settings\";"
                    }
                }]
*/
            }],
        }],
        loaders: [
            /*
             {
             test: /\.js$/,
             exclude: /node_modules/,
             //babel-loader macht "use strict"; was uns stört, darum erstmal deaktiviert
             //TODO überlegen wo/wie der aktiviert werden soll
             loader: "babel-loader"//!./webpack-loader/kwfup-loader?uniquePrefix=webpackbuild"
             },
             */
        ]
    },
    resolve: {
        modules: ["node_modules", "vendor/bower_components"],
        descriptionFiles: ['bower.json', 'package.json'],
        mainFields: ['main', 'browser'],
        plugins: [new BowerResolvePlugin()],
        alias: lookupAliasPaths(),
    },
    resolveLoader: {
        modules: ["node_modules", "vendor/koala-framework/koala-framework/node_modules_add"]
    },
    stats: {
        children: false
    },
    plugins: plugins,
    devServer: {
        stats: {
            children: false
        },
        proxy: {
            '/assets': {
                target: {
                    "host": kwfConfig.domain,
                    "protocol": 'http:',
                    "port": 80
                },
                secure: false,
                changeOrigin: true
            }
        },
        setup: function(app) {
            app.use(function (req, res, next) {
                //required for fonts loaded thru proxy
                res.setHeader("Access-Control-Allow-Origin", "*");
                next();
            });
        }
    }
};
{'fraction_non_alphanumeric': 0.1439232409381663, 'fraction_numerical': 0.0012437810945273632, 'mean_word_length': 1.5973696354407014, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 5, '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': '5214332', 'n_tokens_mistral': 3091, 'n_tokens_neox': 2947, 'n_words': 545}