mattermost/webapp/platform/shared/build/webpack-web-app-externals.cjs
Harrison Healey 2da1e56e6c
MM-67323 Add system for plugins to use shared package and allow plugins to load asynchronously (#35183)
* Remove jest-junit and unignore build folder in web app packages

We don't actually use the file output by jest-junit, and I don't think we
have since we moved off of Jenkins for CI

* Move parcel-namer-shared into build folder

* MM-67323 Add loadSharedDependency API and script for plugins to use it

* Fix client and mattermost-redux packages missing const enums

* Change interface for webAppExternals
2026-02-17 12:57:49 -05:00

31 lines
994 B
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// This script is intended to be used by Mattermost plugins to set up their Webpack externals to share their
// dependencies with the web app. It includes both third party dependencies (React, etc) and the MM Shared package.
const windowExternals = {
react: 'React',
'react-dom': 'ReactDOM',
redux: 'Redux',
luxon: 'Luxon',
'react-redux': 'ReactRedux',
'prop-types': 'PropTypes',
'react-bootstrap': 'ReactBootstrap',
'react-router-dom': 'ReactRouterDom',
'react-intl': 'ReactIntl',
};
function webAppExternals() {
return [
windowExternals,
({request}, callback) => {
if ((/^@mattermost\/shared\//).test(request)) {
return callback(null, `promise globalThis.loadSharedDependency('${request}')`);
}
return callback();
},
];
}
module.exports = webAppExternals;