-
Notifications
You must be signed in to change notification settings - Fork 3
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
Use baseUrl when checking dependencies #32
Comments
Let me play with it. Could you toss a simple project, a I quickly played around with tossing |
Also remembers me about #31, and we shouldn't forget that you can not only load JS but also Templates and even CSS or binary files with RequireJS. |
I've been working on one actually, trying to come up with a few different structure scenarios. I'll post it soon. |
You're right that it does work if So following something you said before, I think that if it's acceptable to Require, Mimosa shouldn't complain about it. So in this example, I have a configuration that works perfectly well from RequireJS's perspective, but generates errors for missing dependencies. I could, of course, have preceded all the module strings with However, it did suddenly occur to me that mimosa-require is actually making use of |
Currently, mimosa-require ignores Require.js' baseUrl (either the implicit default or an explicit value in config) when checking dependency strings that aren't mapped in
paths
, which is pretty much likely to be any non-vendor app module. So it growls errors (that aren't actually errors from Require's point of view) if you don't havemain.js
at the root of javascriptDir, which is the only configuration where mimosa-requires assumption lines up with Require.js' assumption about where modules can be found (assuming no other configuration is set, and who really wants to create path entries for their whole non-vendor folder structure?). Plus, since main.js often contains app code, it just feels wrong not to put it in the app folder, and right now that leads to the need to do all kinds of contortions to avoid error logs.So it would make sense for mimosa-require, rather than to assume javascriptDir, to use baseUrl instead. Not everyone defines one, however, because the default (path of data-main) is reasonable. In that case, you could set the assumed baseUrl at the location of main.js (and perhaps add an option to override the name of the file it looks for since not everyone uses "main.js" or even data-main).
Thoughts?
The text was updated successfully, but these errors were encountered: