const merge = require('webpack-merge');
const baseConfig = require('./base.chrome.config.js');
const webpack = require('webpack');


module.exports = () => {
    const host = process.env.HOST_ADDR || "www.researchexperimentation.fr";
    const protocol = process.env.PROTOCOL || "https";
    console.log("compiling plugin for host ", host, " with ", protocol)
    return merge(baseConfig, {
        mode: 'production',
        plugins: [
            new webpack.DefinePlugin({
                DASHBOARD_URL: JSON.stringify(`${protocol}://${host}`),
                SESSION_URL: JSON.stringify(`${protocol}://${host}/session`),
                MODEL_URL: JSON.stringify(`${protocol}://${host}/model`),
                WEBSITE_URL: JSON.stringify(`${protocol}://${host}/website`),
                CONSTRAINT_URL: JSON.stringify(`${protocol}://${host}/evaluator`),

            })
        ]
    })
};