Mangled file in AMD builds #1684

Closed
asavoy opened this Issue May 10, 2015 · 11 comments

Comments

Projects
None yet
5 participants
@asavoy
Contributor

asavoy commented May 10, 2015

In the amd and amd-dev builds there seems to be a partly mangled file, according to UglifyJS2.

https://github.com/bitovi/canjs.com/blob/master/amd-dev/can/view/system.js
https://github.com/bitovi/canjs.com/blob/master/amd/can/view/system.js

This file isn't in the cjs and steal builds so maybe it just needs to be cleaned up from the AMD builds?

@marshallswain

This comment has been minimized.

Show comment
Hide comment
@marshallswain

marshallswain May 10, 2015

Member

This file is probably the AMD-equivalent version of this one: https://github.com/bitovi/canjs.com/blob/master/steal/can/view/stache/system.js, a plugin for loading CanJS templates.

@daffl I've not used the AMD version. Should this line say imports.intermediate instead of mports.intermediate?

Member

marshallswain commented May 10, 2015

This file is probably the AMD-equivalent version of this one: https://github.com/bitovi/canjs.com/blob/master/steal/can/view/stache/system.js, a plugin for loading CanJS templates.

@daffl I've not used the AMD version. Should this line say imports.intermediate instead of mports.intermediate?

@matthewp

This comment has been minimized.

Show comment
Hide comment
@matthewp

matthewp May 10, 2015

Contributor

Yes, that is a Steal/SystemJS plugin, it should not be part of the AMD build.

Contributor

matthewp commented May 10, 2015

Yes, that is a Steal/SystemJS plugin, it should not be part of the AMD build.

@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl May 11, 2015

Contributor

Those files shouldn't really go into the AMD build but I'd like to figure out why they are so messed up. @matthewp any ideas?

'format steal';
define(['can/view/ejs'], function (can) {
    function translate(load) {
        return 'define([\'can/view/ejs/ejs\'],function(can){' + 'return can.view.preloadStringRenderer(\'' + load.metadata.pluginArgument + '\',' + 'can.EJS(function(_CONTEXT,_VIEW) { ' + new can.EJS({
            text: load.source,
            name: load.name
        }).template.out + ' })' + ')' + '})';
    }
    return { translate: translate };
});
 translate: translate };
});
mports.intermediate) + ')' + '})';
    }
    return { translate: translate };
});
``
Contributor

daffl commented May 11, 2015

Those files shouldn't really go into the AMD build but I'd like to figure out why they are so messed up. @matthewp any ideas?

'format steal';
define(['can/view/ejs'], function (can) {
    function translate(load) {
        return 'define([\'can/view/ejs/ejs\'],function(can){' + 'return can.view.preloadStringRenderer(\'' + load.metadata.pluginArgument + '\',' + 'can.EJS(function(_CONTEXT,_VIEW) { ' + new can.EJS({
            text: load.source,
            name: load.name
        }).template.out + ' })' + ')' + '})';
    }
    return { translate: translate };
});
 translate: translate };
});
mports.intermediate) + ')' + '})';
    }
    return { translate: translate };
});
``

@daffl daffl added this to the 2.2.6 milestone May 11, 2015

@matthewp

This comment has been minimized.

Show comment
Hide comment
@matthewp

matthewp May 11, 2015

Contributor

Not really, best guess is that it's being misidentified as an AMD file because of the return 'define([..' part even though the format: steal should prevent that. If you split up that string into return 'def' + 'ine([..' it might fix that issue.

Contributor

matthewp commented May 11, 2015

Not really, best guess is that it's being misidentified as an AMD file because of the return 'define([..' part even though the format: steal should prevent that. If you split up that string into return 'def' + 'ine([..' it might fix that issue.

daffl added a commit that referenced this issue May 14, 2015

@daffl daffl closed this in #1697 May 14, 2015

@isadovskiy

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Jun 17, 2015

Does it mean there is no way to load stache views and compile them with steal-tools using system plugin in AMD-style project?

Does it mean there is no way to load stache views and compile them with steal-tools using system plugin in AMD-style project?

@matthewp

This comment has been minimized.

Show comment
Hide comment
@matthewp

matthewp Jun 17, 2015

Contributor

@isadovskiy Are you using Steal? If so then yes, you can use AMD or whatever syntax you want to use. It doesn't matter what syntax CanJS itself uses, they all work together.

Contributor

matthewp commented Jun 17, 2015

@isadovskiy Are you using Steal? If so then yes, you can use AMD or whatever syntax you want to use. It doesn't matter what syntax CanJS itself uses, they all work together.

@isadovskiy

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Jun 17, 2015

@matthewp, do you mean we need to configure SystemJS to use "steal" version of the canjs (https://github.com/bitovi/canjs.com/tree/master/steal/can) within our AMD-style project?

@matthewp, do you mean we need to configure SystemJS to use "steal" version of the canjs (https://github.com/bitovi/canjs.com/tree/master/steal/can) within our AMD-style project?

@matthewp

This comment has been minimized.

Show comment
Hide comment
@matthewp

matthewp Jun 17, 2015

Contributor

If you're using SystemJS directly then you'd want to use the AMD version. So to support that use-case we need to fix this bug.

Contributor

matthewp commented Jun 17, 2015

If you're using SystemJS directly then you'd want to use the AMD version. So to support that use-case we need to fix this bug.

@isadovskiy

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Jun 17, 2015

We are going to use StealJS. So "steal" version of CanJS will work for us. But in general it would be great to have AMD version of the system plugin to be compatible with SystemJS as well.

The one thing I really like about the work you guys do in Bitovi is incredible flexibility for any dev workflow. So supporting SystemJS/AMD workflow would be really nice to have.

We are going to use StealJS. So "steal" version of CanJS will work for us. But in general it would be great to have AMD version of the system plugin to be compatible with SystemJS as well.

The one thing I really like about the work you guys do in Bitovi is incredible flexibility for any dev workflow. So supporting SystemJS/AMD workflow would be really nice to have.

@matthewp

This comment has been minimized.

Show comment
Hide comment
@matthewp

matthewp Jun 17, 2015

Contributor

@isadovskiy If you're using NPM you don't need any configuration at all. If you're using Bower then I think probably the steal distribution would be the way to go. In 3.0 the entire repo will be part of Bower as well so you could just use the base directory. But I would highly recommend migrating to NPM if you can.

Contributor

matthewp commented Jun 17, 2015

@isadovskiy If you're using NPM you don't need any configuration at all. If you're using Bower then I think probably the steal distribution would be the way to go. In 3.0 the entire repo will be part of Bower as well so you could just use the base directory. But I would highly recommend migrating to NPM if you can.

@isadovskiy

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Jun 17, 2015

@matthewp, thanks for the tips!

@matthewp, thanks for the tips!

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