Skip to content

Commit

Permalink
Merge pull request #81 from akrantz/prod-assets
Browse files Browse the repository at this point in the history
ensure production build contains assets
  • Loading branch information
akrantz committed Aug 14, 2020
2 parents 74b2e76 + 0792648 commit 4ef2313
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/taskpane/excel.ts
Expand Up @@ -3,6 +3,11 @@
* See LICENSE in the project root for license information.
*/

// images references in the manifest
import "../../assets/icon-16.png";
import "../../assets/icon-32.png";
import "../../assets/icon-80.png";

/* global console, document, Excel, Office */

Office.onReady(info => {
Expand Down
5 changes: 5 additions & 0 deletions src/taskpane/onenote.ts
Expand Up @@ -3,6 +3,11 @@
* See LICENSE in the project root for license information.
*/

// images references in the manifest
import "../../assets/icon-16.png";
import "../../assets/icon-32.png";
import "../../assets/icon-80.png";

/* global document, Office */

Office.onReady(info => {
Expand Down
5 changes: 5 additions & 0 deletions src/taskpane/outlook.ts
Expand Up @@ -3,6 +3,11 @@
* See LICENSE in the project root for license information.
*/

// images references in the manifest
import "../../assets/icon-16.png";
import "../../assets/icon-32.png";
import "../../assets/icon-80.png";

/* global document, Office */

Office.onReady(info => {
Expand Down
5 changes: 5 additions & 0 deletions src/taskpane/powerpoint.ts
Expand Up @@ -3,6 +3,11 @@
* See LICENSE in the project root for license information.
*/

// images references in the manifest
import "../../assets/icon-16.png";
import "../../assets/icon-32.png";
import "../../assets/icon-80.png";

/* global console, document, Office */

Office.onReady(info => {
Expand Down
5 changes: 5 additions & 0 deletions src/taskpane/project.ts
Expand Up @@ -3,6 +3,11 @@
* See LICENSE in the project root for license information.
*/

// images references in the manifest
import "../../assets/icon-16.png";
import "../../assets/icon-32.png";
import "../../assets/icon-80.png";

/* global console document, Office */

Office.onReady(info => {
Expand Down
5 changes: 5 additions & 0 deletions src/taskpane/word.ts
Expand Up @@ -3,6 +3,11 @@
* See LICENSE in the project root for license information.
*/

// images references in the manifest
import "../../assets/icon-16.png";
import "../../assets/icon-32.png";
import "../../assets/icon-80.png";

/* global document, Office, Word */

Office.onReady(info => {
Expand Down
20 changes: 19 additions & 1 deletion webpack.config.js
Expand Up @@ -5,8 +5,12 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const fs = require("fs");
const webpack = require("webpack");

const urlDev="https://localhost:3000/";
const urlProd="https://www.contoso.com/"; // CHANGE THIS TO YOUR PRODUCTION DEPLOYMENT LOCATION

module.exports = async (env, options) => {
const dev = options.mode === "development";
const buildType = dev ? "dev" : "prod";
const config = {
devtool: "source-map",
entry: {
Expand Down Expand Up @@ -36,7 +40,10 @@ module.exports = async (env, options) => {
},
{
test: /\.(png|jpg|jpeg|gif)$/,
use: "file-loader"
loader: "file-loader",
options: {
name: '[path][name].[ext]',
}
}
]
},
Expand All @@ -51,6 +58,17 @@ module.exports = async (env, options) => {
{
to: "taskpane.css",
from: "./src/taskpane/taskpane.css"
},
{
to: "[name]." + buildType + ".[ext]",
from: "manifest*.xml",
transform(content) {
if (dev) {
return content;
} else {
return content.toString().replace(new RegExp(urlDev, "g"), urlProd);
}
}
}
]),
new HtmlWebpackPlugin({
Expand Down

0 comments on commit 4ef2313

Please sign in to comment.