New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enforceDefine triggers error on main file #298
Comments
Ah, right, I should probably exclude the data-main from the define enforcement. I'll mark this for 2.0.1 which I hope to do before the weekend. |
@jrburke Thanks! |
Hmm, thinking more about this, perhaps it is best to document this behavior -- that if enforceDefine is on, then your data-main module needs to use define() too, and then if building with almond, you will need the inserRequire: ['main']) in the build config. Otherwise, if someone did want to detect a failure in the data-main, then there would not be a way to do it. And the enforceDefine is doing its job, enforcing all modules use define or have a shim config. How does that sound? |
Sounds good but what if you're not building with almond? As a note, I am using it to do checking for failures. |
If you are not building with almond, then changing that one require() call to define() is enough, since data-main acts as the first require call. In an almond build, there is not a data-main processing so it needs a require inserted if there is not already one there. |
I added a note to the IE load error section about enforceDefine: and updated the Upgrade doc with the same note. |
@jrburke Looks great. Thanks again! Can't wait to dig into almond a bit. |
It seems like enforceDefine should exclude any config passed in with a require call. The main file below keeps the config seperate but enforceDefine still errors.
}) |
Hey James, just upgraded to Require 2.0. Really nice work. I wanted to report a bug relating to enforceDefine, here's the repro using the require-jquery sample project (also reproducible with the non-require-jquery version, loading jquery as a dep):
Steps
Expected
All modules loaded without errors
Result
All modules loaded, BUT error
No define call for main http://requirejs.org/docs/errors.html#nodefine
displayed in consoleWorkaround
Change
require
todefine
.I've repro'd the bug in Chrome/Firefox latest. Let me know if you need anything else or would like me to email you the files.
The text was updated successfully, but these errors were encountered: