From e2ce4239bd4ef65f8f770e147692f51385fcd1ed Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 9 Mar 2021 14:17:51 -0700 Subject: [PATCH] Improve docs for customisations The new regex considers Windows as an OS, and the added array helps reduce merge conflicts for the future. --- docs/customisations.md | 4 ++-- webpack.config.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/customisations.md b/docs/customisations.md index 2c36b54f9b..39748ebcf6 100644 --- a/docs/customisations.md +++ b/docs/customisations.md @@ -17,11 +17,11 @@ the React SDK, you can still override it from the Element Web layer: 2. Edit customisations points and make sure export the ones you actually want to activate 3. Tweak the Element build process to use the customised module instead of the - default by adding this to end of the `plugins` array in `webpack.config.js`: + default by adding this to the `additionalPlugins` array in `webpack.config.js`: ```js new webpack.NormalModuleReplacementPlugin( - /src\/customisations\/Security.ts/, + /src[\/\\]customisations[\/\\]Security\.ts/, path.resolve(__dirname, 'src/customisations/YourNameSecurity.ts'), ), ``` diff --git a/webpack.config.js b/webpack.config.js index cc79048bb3..2500792139 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,6 +8,10 @@ const webpack = require("webpack"); let og_image_url = process.env.RIOT_OG_IMAGE_URL; if (!og_image_url) og_image_url = 'https://app.element.io/themes/element/img/logos/opengraph.png'; +const additionalPlugins = [ + // This is where you can put your customisation replacements. +]; + module.exports = (env, argv) => { if (process.env.CI_PACKAGE) { // Don't run minification for CI builds (this is only set for runs on develop) @@ -357,6 +361,8 @@ module.exports = (env, argv) => { minify: argv.mode === 'production', chunks: ['usercontent'], }), + + ...additionalPlugins, ], output: {