Closed guilhermeblanco closed 10 years ago
@guilhermeblanco, thanks for the contribution. I can’t automatically merge this pull request. Please fix your branch and add a few lines to readme.
@IgorTimoshenko seems ready to be merged again. =)
@IgorTimoshenko any news on this?
@guilhermeblanco, thanks!
@IgorTimoshenko I'd now consider a v1.0.7 tag! =) Last one was 9 months ago.
@guilhermeblanco, v1.0.7 won't be, v2.0.0 :)
While configuring our application here, we came to a situation where r.js compiles the file and creates at the end something like:
define('.{32}', ['dep1'], function (dep) { ... });
The problem we faced is because we automated page file loading, but there is no way to determine which md5() it creates. We found a way to get it working by hacking and adding the$moduleName
as the define name instead of that md5. As a result of this, multiple attempts showed us it is reliable to make this change and we spent some time to create a patch that is BC.We can discuss this over, but I would like to illustrate our approach for JS loading here: https://gist.github.com/guilhermeblanco/7d00c8cf1413f79ca84e
The difference is that by leaving the file inside of Bundle and by using the module name, we end up creating a file inside of
/js/
with the following path:/js/AcmeDemo/Page/Authentication/Login.js
, which creates the define after compiling with r.js:define('AcmeDemo/Page/Authentication/Login', ...);
, which provides a perfect integration with Symfony routing information:{{ app.request.attributes.get('_route')|replace({'Bundle': '', '_': '/'}) }}
. At the end, all we had to define was abaseUrl
pointing to/js
and everything worked perfectly in the overall strategy we planned.So, at the end, we wanted to provide you back the approach we took with required changes and also provide an idea for other developers on how they could get this bundle on a rather unique way and an architecture that is ready to go.