You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
Because the config is stored in YAML and then converted to JSON, it seems impossible to define a JavaScript function since it will just end up becoming a string. Because YAML and JSON are general data formats, there's no way to even define a JavaScript function.
One possible hack would be to try and detect certain configs that look like a function a strip the quotes after converting to JSON. The non-exhaustive pattern might look like "function\(.*?\)\s*?{.*?}[\s\\n]*". We could also detect certain keys and strip quotes every time, but desired behavior varies across different versions of require.js.
The only other simple alternative I can think of would be to store the config in native JS and just read that in. That might be the simplest and most straightforward.
Thoughts?
The text was updated successfully, but these errors were encountered:
There doesn't seem to be a way to define a JavaScript function to be used for init in a shim: http://requirejs.org/docs/api.html#config-shim.
Because the config is stored in YAML and then converted to JSON, it seems impossible to define a JavaScript function since it will just end up becoming a string. Because YAML and JSON are general data formats, there's no way to even define a JavaScript function.
One possible hack would be to try and detect certain configs that look like a function a strip the quotes after converting to JSON. The non-exhaustive pattern might look like
"function\(.*?\)\s*?{.*?}[\s\\n]*"
. We could also detect certain keys and strip quotes every time, but desired behavior varies across different versions of require.js.The only other simple alternative I can think of would be to store the config in native JS and just read that in. That might be the simplest and most straightforward.
Thoughts?
The text was updated successfully, but these errors were encountered: