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
|
|
|
|
2020-04-09 19:26:56 +02:00
|
|
|
export = () => config_base.config("client").then(config => {
|
|
|
|
Object.assign(config.entry, {
|
2020-08-05 16:36:55 +02:00
|
|
|
"client-app": "./client/app/index.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"),
|
|
|
|
/* backend hasn't declared but its available via "require()" */
|
|
|
|
"tc-backend": path.resolve(__dirname, "shared/backend.d"),
|
|
|
|
});
|
2020-04-01 15:36:37 +02:00
|
|
|
|
2020-08-01 14:54:44 +02:00
|
|
|
if(!Array.isArray(config.externals))
|
|
|
|
throw "invalid config";
|
|
|
|
|
|
|
|
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-07-23 20:00:25 +02:00
|
|
|
config.externals.push({ "jquery": "window.$" });
|
|
|
|
config.externals.push({ "jsrender": "window.$" });
|
|
|
|
|
2020-04-09 19:26:56 +02:00
|
|
|
return Promise.resolve(config);
|
|
|
|
});
|