3

ORO CRM has a piece of code that returns a requires.js config

requirejs.config.js.twig:

paths: {
    {% if app.debug %}
        'oro/routes': '{{ path('fos_js_routing_js', {"callback":    
        "fos.Router.setData"}) }}'
    {% else %}
        'oro/routes': {{ asset('js/routes.js', 
        'routing')|json_encode|raw }}
    {% endif %}
}

in dev mode (debug on), this gets rendered as

paths: { 'oro/routes': '\x2Fapp_dev.php\x2Fjs\x2Frouting\x3Fcallback\x3Dfos.Router.setData' }

... and this works. with the debug mode, however, this will rendered as:

paths: {
   'oro/routes': "\/js\/routes.js"
}

which, with require.js adding another ".js" extension, the browser then tries to retrieve

/js/routes.js.js

(why the backslashes?)

this doesn't work ... so why does this happen? is that a config problem somewhere? or am i too stupid?

regards

.rm

rmalchow
  • 2,689
  • 18
  • 31
  • Well, backslashes are due to `json_encode` – shukshin.ivan Mar 09 '18 at 13:47
  • @shukshin.ivan - really? but it seems someone thinks a slash "/" needs to be encoded ... which is not the case ... hmm. anyways. that wasn't really the problem. that's a weird thing i noticed on the side. – rmalchow Mar 09 '18 at 14:25

1 Answers1

1

It seems you have empty value for next two parameters in parameters.yml: assets_version: null assets_version_strategy: null

Try to set values for them. For example: assets_version: a9f52621 assets_version_strategy: time_hash

Don't forget to clean cache.

  • thank you. i will look into this. on a slight tangent: how do you even find this kind of issue. this seems like a really, really obscure problem. – rmalchow Mar 22 '18 at 10:55
  • Just remove `parameters.yml` in your application. Run `php composer.phar install`. Setup required parameters (DB connection settings for example), other parameters use by default. Then install application. After that all works fine. `assets_version` will be updated automatically and after application installed it will be not `null`. – Mykhailo Sulima Mar 22 '18 at 13:34