Skip to content
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

Fix referencing a sub path relatively from the base dir #95

Merged
merged 1 commit into from
Feb 9, 2016

Conversation

lukeapage
Copy link
Contributor

See tests..

I thought it might be a loader problem but it looks more general..

@lukeapage
Copy link
Contributor Author

@gfranko any chance you can take a look at this? Thanks

@lukeapage
Copy link
Contributor Author

@gfranko do you have time to look at this? it seems like an obvious problem

@ooxi
Copy link
Contributor

ooxi commented Jul 14, 2015

Could you describe the problem in more detail, maybe a testcase? Normally @gfranko acts very quickly quite likely he's on vacation right now.

@lukeapage
Copy link
Contributor Author

I did add a test case in this PR.

any define that is without a path (see test case) it incorrectly generates the variable names for required modules, adding an additional _ to the variable name, causing the the code to not run.

@@ -286,7 +286,13 @@ define([
return pluginName + dep;
}

return pluginName + normalizePath([baseName(moduleId), dep].join('/'));
var moduleBaseName = baseName(moduleId);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if baseName(moduleId) is "" then it gets added as an empty element to the array, causing the array to begin with / when it shouldn't. The generated variable name then doesn't match the one generated for dependencies because it has an additional _ at the begining.

@lukeapage
Copy link
Contributor Author

@gfranko any chance you can take a look?

1 similar comment
@lukeapage
Copy link
Contributor Author

@gfranko any chance you can take a look?

@arieldelfor
Copy link

Hey this solved a same issue i was having!

Stable [email protected] does:

input:

  define(['jquery', 'templates', 'variables', 'json!./data.json'], function(....

output:

   }(jquery, templates, variables, json__datajson);  // note double underscore

image

This branch fix this like a charm:

output:

   }(jquery, templates, variables, json_datajson); // single underscore

Any chance to merge this?

@lukeapage
Copy link
Contributor Author

@gfranko ??

@arieldelfor
Copy link

Meanwhile, since i can't wait to see this fix on reaching for some release, i had to turn my code from 'json!./data.json' into 'json!data.json'.

@gfranko
Copy link
Owner

gfranko commented Feb 9, 2016

@lukeapage thanks for fixing this!

gfranko added a commit that referenced this pull request Feb 9, 2016
Fix referencing a sub path relatively from the base dir
@gfranko gfranko merged commit a337f9a into gfranko:dev Feb 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants