From 80fccbf09380c1e254b9f4ea0aef8943cbaeeb4b Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 2 Nov 2017 08:50:24 +0800 Subject: [PATCH] logs for testing production requires --- assets/javascripts/wizard/custom-wizard.js.es6 | 13 ++++++++++++- .../javascripts/wizard/initializers/custom.js.es6 | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/wizard/custom-wizard.js.es6 b/assets/javascripts/wizard/custom-wizard.js.es6 index 352bbbf6..7ead9265 100644 --- a/assets/javascripts/wizard/custom-wizard.js.es6 +++ b/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); + } + }); + } }); diff --git a/assets/javascripts/wizard/initializers/custom.js.es6 b/assets/javascripts/wizard/initializers/custom.js.es6 index 37a67e02..d5aff7a8 100644 --- a/assets/javascripts/wizard/initializers/custom.js.es6 +++ b/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;