0

I have a require statement that loads in a layer that I build with Dojo. I want to be able to test my code without having to build my Dojo source every time. However, if I don't build and the require statement is called, it fails with a 404 error.

Is there any way to catch this 404 error and allow it to fail?

Asher Johnson
  • 751
  • 1
  • 7
  • 10

1 Answers1

1

Any module in an application can be converted into a “layer” module, which consists of the original module + additional dependencies built into the same file. Using layers allows applications to reduce the number of HTTP requests by combining all JavaScript into a single file. Creating a new layer file just for the production version of your application is not the correct way to create a build. Instead, build into a module that you’re already loading in development. Then, your require calls never change between development and production; the only difference is that your layered modules contain their dependencies.

C Snover
  • 17,908
  • 5
  • 29
  • 39
  • That makes sense, but what about in the case where there is no original module? For instance I have a layer I build that is a combination of "dojo/ready", "dojo/topic", "dojo/on", "dijit/registry", and "dijit/form/Form". I'm not sure what to build that into that would work before the build as well – Asher Johnson Jan 13 '15 at 17:47
  • There is always at least one original module, `dojo/dojo`. :) – C Snover Jan 14 '15 at 17:40