"use strict";var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},__assign.apply(this,arguments)},__awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(a,o){function i(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?a(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,s)}u((n=n.apply(t,e||[])).next())}))},__generator=this&&this.__generator||function(t,e){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=e.call(t,i)}catch(t){o=[6,t],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},__spreadArray=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,a=0,o=e.length;a<o;a++)!n&&a in e||(n||(n=Array.prototype.slice.call(e,0,a)),n[a]=e[a]);return t.concat(n||Array.prototype.slice.call(e))},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};exports.__esModule=!0;var component_base_config_1=__importDefault(require("./component.base.config")),utils_1=require("./utils"),paths=require("../../utils/paths"),path=require("path").posix,buildConfigCreater=function(t,e){return __awaiter(void 0,void 0,void 0,(function(){function r(t){return __awaiter(this,void 0,void 0,(function(){var r;return __generator(this,(function(n){switch(n.label){case 0:return e(t),[4,(0,utils_1.getPackageVersion)(u,t)];case 1:return r=n.sent(),c[t]=r,[2]}}))}))}var n,a,o,i,s,u,c,l,p,_;return __generator(this,(function(e){switch(e.label){case 0:return[4,(0,utils_1.getComponentInfo)(t)];case 1:return n=e.sent(),a=n.name,o=n.version,i=n.entry,s="production",process.env.BABEL_ENV=s,u=[t,paths.appDirectory],c={},l=path.join(paths.userCompileOutput,"".concat(a,"/custom/").concat(a,"/").concat(o)),p=path.join("custom/".concat(a,"/").concat(o)),(_=(0,component_base_config_1.default)(s,t)).plugins=__spreadArray(__spreadArray([],_.plugins,!0),[new utils_1.ModfiySourceWebpackPlugin(c)],!1),[2,__assign(__assign({},_),{mode:s,context:paths.root,entry:i,output:{path:l,filename:"index.js",library:p,libraryTarget:"amd"},devtool:!1,externals:[(0,utils_1.reflectThreePackageAndExternals)(r),"react"]})]}}))}))};exports.default=buildConfigCreater;