I'm trying to embed an EmberJS application into a large portal application which uses extensively the RequireJS library. I'm using ember-cli to build the project. The built application consists of two files, dist/assets/vendor.js
and dist/assets/myapp.js
. The EmberJS application works after embedding it but the portal app's javascript breaks.
After some research I've found out the problem is that vendor.js
defines its own variables require
, requirejs
, requireModule
and define
which conflict with the website's variables in the global namespace. The myapp.js
file then contains define
statements which load the app's modules.
Is there a way to rename these or to put them into some different namespace?
The only solution I came up with was to manually rename the variables within the two .js
files. This seems to work but it's rather cumbersome and it'd be nice if it could be automated. I have also found out about using RequireJS optimizer but I can't get it to work with the vendor.js
file.
Can you help me? Thanks!