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