Activate React components loader
This commit is contained in:
parent
46a5be2843
commit
5a032d344d
2 changed files with 12 additions and 0 deletions
|
@ -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;
|
||||||
|
|
8
app/javascript/shared/react-components.js
vendored
Normal file
8
app/javascript/shared/react-components.js
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
export default function reactComponents(className) {
|
||||||
|
switch (className) {
|
||||||
|
case 'TypesDeChampEditor':
|
||||||
|
return import('components/TypesDeChampEditor').then(
|
||||||
|
mod => mod.createReactUJSElement
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue