Skip to content

whitespace after "require" changes behavior #265

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

Closed
shovemedia opened this issue May 11, 2012 · 5 comments
Closed

whitespace after "require" changes behavior #265

shovemedia opened this issue May 11, 2012 · 5 comments
Milestone

Comments

@shovemedia
Copy link

A very simple test case at http://shovemedia.com/requirejsissue.zip

See /js/Main.js for two lines you can swap back and forth.
The only difference is the whitespace.

If you bring up index.html in Chrome with the javascript console, you'll
see an alert when the extra space is removed (correct behavior),
and the following error when it's present:
Uncaught Error: Module name 'SomeModule' has not been loaded yet for context:

Tested with the latest version before sending, both commented and minified.

@jrburke
Copy link
Member

jrburke commented May 11, 2012

Right now I'm getting a 404 for that zip file, just let me know when it is working, and I'll give it a try.

@shovemedia
Copy link
Author

http://shovemedia.com/requirejsIssue.zip

Silly capitalization. Knew I should have double-checked my link

:j

On May 11, 2012, at 1:23 PM, James Burke reply@reply.github.com wrote:

Right now I'm getting a 404 for that zip file, just let me know when it is working, and I'll give it a try.


Reply to this email directly or view it on GitHub:
#265 (comment)

@jrburke
Copy link
Member

jrburke commented May 11, 2012

Ouch, yeah, just a regexp problem. Looks like there was a recent change in the behavior of Function.prototype.toString() in at least Chrome, probably all latest WebKit browsers. For what it is worth, this is only an issue in source form, after a build it, the optimizer would have found it correctly. But the source form is super important to have working, and the regexp should have allowed for this anyway.

It is fixed now in the dev2.0 branch, and I updated the errors page to mention this problem in 1.0.x, may do a backport if a 1.0.9 release gets scheduled.

@shovemedia
Copy link
Author

I'm not sure I follow the "build" workflow you mention. Can you point me to a resource that explains?

and thanks!
:j

On May 11, 2012, at 2:15 PM, James Burke wrote:

Ouch, yeah, just a regexp problem. Looks like there was a recent change in the behavior of Function.prototype.toString() in at least Chrome, probably all latest WebKit browsers. For what it is worth, this is only an issue in source form, after a build it, the optimizer would have found it correctly. But the source form is super important to have working, and the regexp should have allowed for this anyway.

It is fixed now in the dev2.0 branch, and I updated the errors page to mention this problem in 1.0.x, may do a backport if a 1.0.9 release gets scheduled.


Reply to this email directly or view it on GitHub:
#265 (comment)

@jrburke
Copy link
Member

jrburke commented May 11, 2012

I meant the requirejs optimizer, r.js, would have found the dependency, but normally that is just used for when doing a build to combine your resources together, not helpful for dev/source loading:

http://requirejs.org/docs/optimization.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants