Project

General

Profile

Feature #20097

Allow plugins webpack code to be used

Added by Daniel Lobato Garcia about 1 year ago. Updated 10 days ago.

Status:
Closed
Priority:
Normal
Category:
Plugins-Engines
Target version:
Team Backlog:
Fixed in Releases:
Found in Releases:

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 (diff)
Added by Ohad Levy about 1 year 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 (diff)
Added by Ohad Levy about 1 year ago

refs #20097 - use relative path in webpack config

History

#1 Updated by The Foreman Bot about 1 year ago

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

#2 Updated by The Foreman Bot about 1 year ago

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

#3 Updated by Ohad Levy about 1 year ago

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

#4 Updated by Daniel Lobato Garcia about 1 year ago

  • Legacy Backlogs Release (now unused) set to 240

#5 Updated by Ohad Levy about 1 year ago

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

#6 Updated by The Foreman Bot about 1 year ago

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

Also available in: Atom PDF