//230279 light-sdk支持全局JSCore
const config = require("./webpack.config");
const merge = require("webpack-merge");
const webpack = require('webpack');

let webpackConfig = merge(config, {
    entry: [`${light.config.src}/gmu.global.js`],
    output: {
        path: light.config.dist,
        filename: 'gmu.global.js',
    },
    plugins: [
        new webpack.DefinePlugin({
            'process.env.RUNTIME': JSON.stringify("globalJSCore"),
            'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
            '__ENV__': require("./env")(light.options.env || 'default')
        }),
    ]
});


module.exports = {
    build() {
        light.util.log("info", "准备编译gmu.global.js文件...");
        return webpackConfig;
    }
};