implement phase 4
This commit is contained in:
parent
25c2ce53cd
commit
f4b1c3e14b
27 changed files with 6929 additions and 48 deletions
|
|
@ -8,6 +8,11 @@ const webpack = require("webpack");
|
|||
const urlDev = "https://localhost:3000/";
|
||||
const urlProd = "https://www.contoso.com/"; // CHANGE THIS TO YOUR PRODUCTION DEPLOYMENT LOCATION
|
||||
|
||||
// config ที่ inject เข้าโค้ดตอน build (อ่านจาก env — ห้าม hardcode ตามกติกา) — default คือ local dev
|
||||
const keycloakAuthority = process.env.KEYCLOAK_AUTHORITY || "http://localhost:8080/realms/word-versioning";
|
||||
const keycloakClientId = process.env.KEYCLOAK_CLIENT_ID || "word-addin-officejs";
|
||||
const apiBaseUrl = (process.env.API_BASE_URL || "http://localhost:5075").replace(/\/$/, "");
|
||||
|
||||
async function getHttpsOptions() {
|
||||
const httpsOptions = await devCerts.getHttpsServerOptions();
|
||||
return { ca: httpsOptions.ca, key: httpsOptions.key, cert: httpsOptions.cert };
|
||||
|
|
@ -24,6 +29,7 @@ module.exports = async (env, options) => {
|
|||
import: ["./src/taskpane/index.tsx", "./src/taskpane/taskpane.html"],
|
||||
dependOn: "react",
|
||||
},
|
||||
authCallback: "./src/taskpane/auth-callback.ts",
|
||||
commands: "./src/commands/commands.ts",
|
||||
},
|
||||
output: {
|
||||
|
|
@ -66,6 +72,12 @@ module.exports = async (env, options) => {
|
|||
template: "./src/taskpane/taskpane.html",
|
||||
chunks: ["polyfill", "taskpane", "react"],
|
||||
}),
|
||||
// หน้า redirect ของ Keycloak ที่รันใน Office Dialog (FR-8) — ต้องอยู่ที่ root ตรง redirect URI
|
||||
new HtmlWebpackPlugin({
|
||||
filename: "auth-callback.html",
|
||||
template: "./src/taskpane/auth-callback.html",
|
||||
chunks: ["polyfill", "authCallback"],
|
||||
}),
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{
|
||||
|
|
@ -93,6 +105,12 @@ module.exports = async (env, options) => {
|
|||
new webpack.ProvidePlugin({
|
||||
Promise: ["es6-promise", "Promise"],
|
||||
}),
|
||||
// ค่า config ที่โค้ดอ่านผ่าน src/config.ts — แทนที่ตอน build ด้วยค่าจาก env
|
||||
new webpack.DefinePlugin({
|
||||
__KEYCLOAK_AUTHORITY__: JSON.stringify(keycloakAuthority),
|
||||
__KEYCLOAK_CLIENT_ID__: JSON.stringify(keycloakClientId),
|
||||
__API_BASE_URL__: JSON.stringify(apiBaseUrl),
|
||||
}),
|
||||
],
|
||||
devServer: {
|
||||
hot: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue