2020-04-01 13:36:37 +00:00
|
|
|
import * as path from "path";
|
2020-04-01 19:47:33 +00:00
|
|
|
import * as config_base from "./webpack.config";
|
2020-04-01 13:36:37 +00:00
|
|
|
|
2021-03-17 18:41:51 +00:00
|
|
|
export = env => config_base.config(env, "client").then(config => {
|
2020-04-09 17:26:56 +00:00
|
|
|
Object.assign(config.entry, {
|
2021-03-20 15:39:50 +00:00
|
|
|
"main-app": ["./client/app/entry-points/AppMain.ts"],
|
2021-03-20 14:10:16 +00:00
|
|
|
"modal-external": ["./client/app/entry-points/ModalWindow.ts"]
|
2020-04-09 17:26:56 +00:00
|
|
|
});
|
2020-04-01 13:36:37 +00:00
|
|
|
|
2020-04-09 17:26:56 +00:00
|
|
|
Object.assign(config.resolve.alias, {
|
|
|
|
"tc-shared": path.resolve(__dirname, "shared/js"),
|
|
|
|
});
|
2020-04-01 13:36:37 +00:00
|
|
|
|
2021-03-20 14:10:16 +00:00
|
|
|
if(!Array.isArray(config.externals)) {
|
2020-08-01 12:54:44 +00:00
|
|
|
throw "invalid config";
|
2021-03-20 14:10:16 +00:00
|
|
|
}
|
2020-08-01 12:54:44 +00:00
|
|
|
|
2021-03-17 12:28:27 +00:00
|
|
|
config.externals.push(({ context, request }, callback) => {
|
2020-09-30 20:51:04 +00:00
|
|
|
if (request.startsWith("tc-backend/")) {
|
2020-04-09 17:26:56 +00:00
|
|
|
return callback(null, `window["backend-loader"].require("${request}")`);
|
2020-09-30 20:51:04 +00:00
|
|
|
}
|
|
|
|
|
2020-08-01 12:54:44 +00:00
|
|
|
callback(undefined, undefined);
|
2020-04-09 17:26:56 +00:00
|
|
|
});
|
2020-04-01 13:36:37 +00:00
|
|
|
|
2020-04-09 17:26:56 +00:00
|
|
|
return Promise.resolve(config);
|
|
|
|
});
|