I’m looking for a pattern for code that should run before Ember boots. I’m thinking of things like initializing tracking libraries and checking browser compatibility.
ember-cli-google-analytics injects an inline <script> into <head>. I don’t love that because it violates Content-Security-Policy (unless you generate a cryptographic hash of the inline script contents and add that to the CSP definition).
Another option would be putting the code in app/initializers/. I don’t love that (at least for the browser-compatibility detection) because the browser may never get to initializers.
I’m considering adding a pre-boot/ directory that gets appended to app.js without being wrapped in require.define blocks so it executes immediately.
Does anyone have a pattern they really like?