-
Notifications
You must be signed in to change notification settings - Fork 38
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
postal.xframe and webpack #22
Comments
@RainerAtSpirit Can you provide more detail on what errors you are running into with this UMD wrapper with webpack, as well as versions (of postal.xframe and webpack ,etc.)? My team at LeanKit is using webpack with a number of libraries with UMD wrappers that perform the AMD check first without any issue - so this is a surprise to me. Thanks! |
@ifandelse This might be an edge case when using webpack: 1.6.0 bower components: require.ensure(['postal', 'riveter', 'postal.federation', 'postal.xframe', 'postal.request-response'], function( require ) {
var postal = require('postal');
var riveter = require('riveter');
var federation = require('postal.federation')(_, postal, riveter);
//todo: Workaround. Requires changing the order of AMD vs Module test in bower_components/postal.xframe/lib/postal.xframe.js
var xframe = require('postal.xframe')(federation);
require('postal.request-response');
console.log('postal', federation);
// waiting for all promises to be resolved
$.when.apply($, promises).then(function() {
ko.applyBindings(koViewModel, element);
// Kick off postal example
require('./main')(postal, listsInfo, dsMap);
});
}, 'postal'); |
@ifandelse I've created a small sample repo that demonstrates the behavior. All sources included so a https://github.com/RainerAtSpirit/postalWebpack Good news there's a webpack configuration that prevents execution of the AMD check in var xframe = require('imports?define=>false!postal.xframe')(postal); https://github.com/RainerAtSpirit/postalWebpack/blob/master/src/app/postal.js#L10 |
I've got some problems using require.js with postal, postal.xframe, postal.federation
I'm not a require.js guru. Does exists an example that explains how to use them. |
postal.xframe (bower) won't work OOTB with webpack.
Seems that the order of AMD vs CommonJS check in this environment must be CommonJS first like in postal.federation.
While this violates the consense made in http://ifandelse.com/its-not-hard-making-your-library-support-amd-and-commonjs/#update2 reversing the order solves the issue for webpack.
The text was updated successfully, but these errors were encountered: