Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,42 @@ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const dependencies = packageJson.dependencies || {};
const devDependencies = packageJson.devDependencies || {};
const allDependencies = { ...dependencies, ...devDependencies };
const shared = isPlugin =>
Object.keys(allDependencies).map(dep => ({
const shared = isPlugin => {
const sharedArr = Object.keys(allDependencies).map(dep => ({
[dep]: {
eager: !isPlugin, // core should load all dependencies eagerly so they will be available for plugins
singleton: true,
requiredVersion: allDependencies[dep],
import: isPlugin ? false : dep,
},
}));
return [
...sharedArr,
{
/*
have to use '@scalprum/core/index' in vendor.js entry otherwise we get
Uncaught ReferenceError: __webpack_exports__ is not defined
but without need to "convert" @scalprum/core/index to @scalprum/core
so the shared context can find it
*/
'@scalprum/react-core': {
eager: !isPlugin,
singleton: true,
import: isPlugin ? false : '@scalprum/react-core/index',
packageName: '@scalprum/react-core',
},
},
{
'@scalprum/core': {
eager: !isPlugin,
singleton: true,
import: isPlugin ? false : '@scalprum/core/index',
import: '@scalprum/core/index',
packageName: '@scalprum/core',
},
},
];
};

class AddRuntimeRequirement {
// to avoid "webpackRequire.l is not a function" error
Expand Down Expand Up @@ -97,19 +124,17 @@ const commonConfig = function() {
},
alias: {
'patternfly-react$': path.resolve(
__dirname,
'..',
root,
'node_modules/patternfly-react/dist/js/index.js'
), // to avoid circular dependency in dist/esm
'/node_modules/jquery': path.resolve(
__dirname,
'..',
root,
'webpack/assets/javascripts/jquery.js'
),
jquery: path.resolve(root, 'webpack/assets/javascripts/jquery.js'),
foremanReact: path.join(
__dirname,
'../webpack/assets/javascripts/react_app'
root,
'/webpack/assets/javascripts/react_app'
),
'react/jsx-runtime': 'react/jsx-runtime.js', // for react-dnd
'react/jsx-dev-runtime': 'react/jsx-dev-runtime.js', // for react-dnd
Expand Down Expand Up @@ -291,8 +316,7 @@ const pluginConfig = function(plugin) {
var chunkFilename = '[name]-[chunkhash].js';
} else {
var outputPath = path.join(
__dirname,
'..',
root,
'public',
'webpack',
pluginName
Expand Down
12 changes: 11 additions & 1 deletion config/webpack.vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,17 @@ module.exports = [
'select2',
'multiselect',
'@novnc/novnc/core/rfb',

'sanitize-html',

/*
* for rh_cloud
* /index is a workaround until we find a better way
*/
'unleash-proxy-client',
'@unleash/proxy-client-react',
'@scalprum/core/index',
'@scalprum/react-core/index',
Comment thread
ShimShtein marked this conversation as resolved.
Outdated

// '@webcomponents/webcomponentsjs/webcomponents-bundle',
// '@webcomponents/webcomponentsjs/custom-elements-es5-adapter',
];
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@
"@patternfly/react-table": "^5.2.0",
"@patternfly/react-tokens": "^5.2.0",
"@reduxjs/toolkit": "^1.6.0",
"@scalprum/core": "^0.8.1",
"@scalprum/react-core": "^0.9.3",
"@spice-project/spice-html5": "^0.2.1",
"@theforeman/vendor": "^15.0.0",
"@unleash/proxy-client-react": "^5.0.0",
"@webcomponents/webcomponentsjs": "^2.2.10",
"ace-builds": "^1.4.13",
"axios": "^0.21.1",
Expand Down Expand Up @@ -97,6 +100,7 @@
"seamless-immutable": "^7.1.2",
"select2": "4.0.12",
"unidiff": "^1.0.0",
"unleash-proxy-client": "^3.7.6",
"urijs": "^1.19.4",
"uuid": "^3.3.2",
"yup": "^0.29.3"
Expand Down
Loading