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