requirejsng-admin

correct way to include requirejs in ng-admin


What is the correct way to include requirejs in ng-admin? A lot of the doucmentation uses require, but it's not loaded by default anymore.

I udpated bower.json dependencies to include requirejs and requirejs-text, and ran bower update:

"dependencies": { "angular": "~1.4.0", "angular-route": "~1.4.0", "angular-loader": "~1.4.0", "angular-mocks": "~1.4.0", "html5-boilerplate": "~5.2.0", "requirejs": "~2.1.14", "requirejs-text": "~2.0.12", "ng-admin": "^0.9.1" }

However, when trying to use it in ng-admin, I either get "require is not defined" or if I try to include it in index.html i get "Mismatched anonymous define() modules." Any help would be appreciated!


Solution

  • Use Webpack or bower instead. Not only do they understand require, but they will also package and minify all the code into one .js file, which is a must in production.

    Ng-admin used RequireJS in the past, and has switched to webpack at least 6 months ago.