You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 9, 2020. It is now read-only.
So, in my further library writing regarding backbone-parse-es6 to solve a serialization issue I now have to override a Parse library file (ParseObject). This new class BackboneParseObject imports a file from parse/lib/browser/encode.js with parse being aliased to npm:parse. When creating a SFX bundle for backbone-parse-es6 which excludes external dependencies including Parse I use this 'meta' config.
In particular I mark as external dependencies anything under this path: "parse/lib/browser/*": { "build": false }
Currently in utils.js -> getAlias (outdated / fix applied!) only the canonical name of the module is resolved which is just parse and the path is dropped. This is no good and causes things to break for the SFX bundle. For instance for the AMD bundle it looks like this:
Here is a new getAlias with my changes to support canonical paths in addition to canonical name substitution / matching:
exports.getAlias = getAlias
function getAlias(loader, canonicalName) {
var pluginIndex = loader.pluginFirst ? canonicalName.indexOf('!') : canonicalName.lastIndexOf('!');
if (pluginIndex != -1)
return getAlias(loader, canonicalName.substr(0, pluginIndex)) + '!' + getAlias(loader, canonicalName.substr(pluginIndex + 1));
if (canonicalName.match(/\#[\:\{\?]/))
throw new Error('Get alias not implemented for conditional name "' + canonicalName + '". Remove the conditional exclusion, or post a SystemJS Builder bug if needed!');
var canonicalPath;
if (canonicalName.indexOf('/') >= 0)
canonicalPath = canonicalName.substr(canonicalName.indexOf('/'), canonicalName.length);
var bestAlias;
function getBestAlias(mapped) {
return canonicalName.substr(0, mapped.length) == mapped &&
(canonicalName.length == mapped.length || canonicalName[mapped.length] == '/');
}
Object.keys(loader.map).forEach(function(alias) {
if (getBestAlias(loader.map[alias]))
{
bestAlias = alias;
if (canonicalPath)
bestAlias += canonicalPath;
}
});
if (bestAlias)
return bestAlias;
return canonicalName;
}
The above change does the trick and properly exports the aliased name + canonical path correctly. I don't have any visibility into if such a change would cause problems. If so though perhaps an additional meta boolean buildIncludePath could be added and when setting to true ala: "parse/lib/browser/*": { "build": false, "buildIncludePath": true } then the canonical path is included.
I can create a PR, but just want to get your input on the issue first.
Thanks...
The text was updated successfully, but these errors were encountered:
Greets Guy et al,
So, in my further library writing regarding backbone-parse-es6 to solve a serialization issue I now have to override a Parse library file (ParseObject). This new class BackboneParseObject imports a file from
parse/lib/browser/encode.js
withparse
being aliased tonpm:parse
. When creating a SFX bundle for backbone-parse-es6 which excludes external dependencies including Parse I use this 'meta' config.In particular I mark as external dependencies anything under this path:
"parse/lib/browser/*": { "build": false }
Currently in utils.js -> getAlias (outdated / fix applied!) only the canonical name of the module is resolved which is just
parse
and the path is dropped. This is no good and causes things to break for the SFX bundle. For instance for the AMD bundle it looks like this:when it really should be this:
The potential issue is in utils.js -> getAlias and in particular right here.
Here is a new getAlias with my changes to support canonical paths in addition to canonical name substitution / matching:
The above change does the trick and properly exports the aliased name + canonical path correctly. I don't have any visibility into if such a change would cause problems. If so though perhaps an additional meta boolean
buildIncludePath
could be added and when setting to true ala:"parse/lib/browser/*": { "build": false, "buildIncludePath": true }
then the canonical path is included.I can create a PR, but just want to get your input on the issue first.
Thanks...
The text was updated successfully, but these errors were encountered: