Browse Source

logs for testing production requires

Angus McLeod 7 years ago
parent
commit
80fccbf093

+ 12 - 1
assets/javascripts/wizard/custom-wizard.js.es6

@@ -1,5 +1,16 @@
 import WizardApplication from 'wizard/wizard';
 
 export default WizardApplication.extend({
-  rootElement: '#custom-wizard-main'
+  rootElement: '#custom-wizard-main',
+
+  start() {
+    Object.keys(requirejs._eak_seen).forEach(key => {
+      if (/\/initializers\//.test(key)) {
+        console.log('running initializer', key);
+        const module = requirejs(key, null, null, true);
+        if (!module) { throw new Error(key + ' must export an initializer.'); }
+        this.initializer(module.default);
+      }
+    });
+  }
 });

+ 1 - 0
assets/javascripts/wizard/initializers/custom.js.es6

@@ -2,6 +2,7 @@ export default {
   name: 'custom-routes',
 
   initialize(app) {
+    console.log('running initializer', app.constructor.name, app.get('rootElement'))
     if (app.constructor.name !== 'Class' || app.get('rootElement') !== '#custom-wizard-main') return;
 
     const Router = requirejs('wizard/router').default;