-
Notifications
You must be signed in to change notification settings - Fork 25
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
map config sometimes improperly applied to loader resource name #47
Comments
This is definitely an issue: the module ID is getting resolved twice with a map config, which is incorrect. It affects map items that use a loader and the first non-loader part of the ID is the same as the value before it. I am not sure yet how to fix it yet. I have been away from the code long enough that I think it will take a larger change to fix. No quick and easy fix. Will leave this open to track the issue, but I do not expect to resolve it in the near future. |
Test file to add to show the error in tests at <!DOCTYPE html>
<html>
<head>
<title>alameda: Simple Test</title>
<script type="text/javascript" src="doh/runner.js"></script>
<script type="text/javascript" src="doh/_browserRunner.js"></script>
<script src="../alameda.js"></script>
<script type="text/javascript">
var foorequire = requirejs.config({
context: 'foo',
map: {
'*': {
'modules/constants': 'loader!modules/constants'
}
}
});
define("loader", [], () => {
return {
load: function(name, localRequire, onload, config) {
console.log(name);
}
};
});
foorequire(["modules/constants/foo"]);
require(['modules/constants/foo'], function (foo) {
doh.register(
'mapConfigPluginMultiSegment',
[
function mapConfigPluginMultiSegment(t){
t.is('foo', foo.name);
}
]
);
doh.run();
});
</script>
</head>
<body>
<h1>alameda: mapConfigPluginMultiSegment Test</h1>
<p>Check console for messages</p>
</body>
</html> |
my guess is that while this is a situation that shows the bug, it's not the only one - doesn't this mean that all resource names are going through the |
expected output:
modules/constants/foo
actual output:
loader!modules/constants/foo
if the
map
is changed to something different like{'*': {'modules/constants': 'loader!constants'}}
the unexpected map application seems not to apply (and in which case the output of the example isconstants/foo
instead).the loader api docs make no mention that the
map
config should apply to the loader resource names, and I believe this is a bug. https://requirejs.org/docs/plugins.htmlI think I've seen this working nondeterministically in the past but I'm having a hard time working that into my repro.
The text was updated successfully, but these errors were encountered: