RequireJS Optimization

advertisements

I`m using r.js to optimize my app, as i saw in several samples, i used build.json configuration file to config my optimization options.

The problem is that when i set reference to the output javascript file after optimization I`m getting the following error in the browser:

Uncaught ReferenceError: define is not defined main-built.js:14735

Looks like, all my app modules are exists but RequireJs is missing.

This is my build.json configuration file:

{
  "baseUrl": "../",
  "name": "src/modules/main",
  "include": ["src/modules/main", "src/modules/navbar/navbar", "src/modules/contact/contact", "src/modules/about/about"],
  "exclude": [], "optimize": "none", "out": "main-built.js",
  "insertRequire": ["src/modules/main"]
}

How do i add requirejs to the output js file? maybe i need to add something else to config? or maybe the problem is not the config?

Thanks, Ori


Try:

<script src="scripts/require.js" data-main="scripts/main-built"></script>