{"size": 553, "ext": "js", "max_stars_repo_path": "test/helpers/webpack.js", "max_stars_repo_name": "thecrypticace/laravel-mix", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/helpers/webpack.js", "max_issues_repo_name": "thecrypticace/laravel-mix", "max_issues_repo_issues_event_min_datetime": "2018-04-12T13:02:25.000Z", "max_issues_repo_issues_event_max_datetime": "2018-04-19T23:42:14.000Z", "max_forks_repo_path": "test/helpers/webpack.js", "max_forks_repo_name": "thecrypticace/laravel-mix", "max_forks_repo_forks_event_min_datetime": "2018-04-04T21:43:35.000Z", "max_forks_repo_forks_event_max_datetime": "2020-12-03T23:50:53.000Z"}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": 7, "avg_line_length": 21.2692307692, "max_line_length": 48, "alphanum_fraction": 0.5280289331}
import webpack from 'webpack';

export function buildConfig() {
    require('../../src/index');

    Mix.dispatch('init');

    return new WebpackConfig().build();
}

export async function compile(config) {
    config = config || buildConfig();

    return new Promise((resolve, reject) => {
        webpack(config, (err, stats) => {
            if (err) {
                reject({ config, err, stats });
            } else {
                resolve({ config, err, stats });
            }
        });
    });
}

export default { buildConfig, compile };
