Activate React components loader

This commit is contained in:
Paul Chavard 2019-03-20 16:29:19 +03:00
parent 46a5be2843
commit 5a032d344d
2 changed files with 12 additions and 0 deletions

View file

@ -4,7 +4,9 @@ import Rails from 'rails-ujs';
import * as ActiveStorage from 'activestorage'; import * as ActiveStorage from 'activestorage';
import Chartkick from 'chartkick'; import Chartkick from 'chartkick';
import Highcharts from 'highcharts'; import Highcharts from 'highcharts';
import ReactUJS from '../shared/react-ujs'; import ReactUJS from '../shared/react-ujs';
import reactComponents from '../shared/react-components';
import '../shared/activestorage/ujs'; import '../shared/activestorage/ujs';
import '../shared/rails-ujs-fix'; import '../shared/rails-ujs-fix';
@ -47,6 +49,8 @@ Rails.start();
Turbolinks.start(); Turbolinks.start();
ActiveStorage.start(); ActiveStorage.start();
const loader = new ReactUJS(reactComponents);
loader.start();
// Expose globals // Expose globals
window.DS = window.DS || DS; window.DS = window.DS || DS;

View file

@ -0,0 +1,8 @@
export default function reactComponents(className) {
switch (className) {
case 'TypesDeChampEditor':
return import('components/TypesDeChampEditor').then(
mod => mod.createReactUJSElement
);
}
}