Feature #20097

Allow plugins webpack code to be used

Added by Daniel Lobato Garcia 10 months ago. Updated 10 months ago.

Status:Closed
Priority:Normal
Assigned To:Daniel Lobato Garcia
Category:Plugins-Engines
Target version:-
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4625, https://github.com/theforeman/foreman/pull/4643
Story points-
Velocity based estimate-
Release1.16.0Release relationshipAuto

Description

At the moment, the only entrypoint for webpack seems to be /webpack. webpack.config.js should also support code coming from plugins.
Using bundler, we can fetch this directory trivially - a dumb heuristic could be to add as an entry point the '/webpack' directory of all gem dependencies that look like "foreman*".

Associated revisions

Revision caa81e6f
Added by Ohad Levy 10 months ago

fixes #20097 - webpack support for foreman plugins

How to use:

in a plugin, create a directory call webpack
then inside a file called index.js put something like:

```
import React from 'react';
import ReactDOM from 'react-dom';
import Icon from 'foremanReact/common/Icon';

const reactNode = document.querySelector('#content');

if (reactNode) {
ReactDOM.render(
<Icon type='ok' />,
reactNode);
};

```
TODOS:

- support JEST / eslint
- extend the react mounter, so plugins can add more mounting points and
use them.
- update storybook to support plugins too
- make equivalnt of rake test

Revision 2be096df
Added by Ohad Levy 10 months ago

refs #20097 - use relative path in webpack config

History

#1 Updated by The Foreman Bot 10 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman/pull/4619 added

#2 Updated by The Foreman Bot 10 months ago

  • Pull request https://github.com/theforeman/foreman/pull/4625 added

#3 Updated by Ohad Levy 10 months ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/4619)

#4 Updated by Daniel Lobato Garcia 10 months ago

  • Release set to 1.16.0

#5 Updated by Ohad Levy 10 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#6 Updated by The Foreman Bot 10 months ago

  • Pull request https://github.com/theforeman/foreman/pull/4643 added

Also available in: Atom PDF