-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Backbone packaging issue #34
Comments
Here are those first lines of backbone.js creating the issue: (function(root, factory) {
// Set up Backbone appropriately for the environment.
if (typeof exports !== 'undefined') { // why is exports === undefined?
// Node/CommonJS, no need for jQuery in that case.
factory(root, exports, require('underscore'));
} else if (typeof define === 'function' && define.amd) {
// AMD
define(['underscore', 'jquery', 'exports'], function(_, $, exports) { // LINE 15
// Export global even in AMD case in case this script is loaded with
// others that may still expect a global Backbone.
root.Backbone = factory(root, exports, _, $);
});
} else { |
Unfortunately, I stumbled across another error while trying to ignore the above warning: When I define my own View via
For now, I worked around the issue by including |
Maybe there is a way to omit the AMD flags completely if you wrap the define function and export AMD modules automatically? |
I fixed the exports bug. Keep in mind that the versions published to the jam package manager are special AMD versions and maybe behave different from the original versions. It also includes the jam jquery, which requires a special jquery flag in the In CommonJS Backbone don't require jquery, thats weird... if (typeof exports !== 'undefined') {
// Node/CommonJS, no need for jQuery in that case.
factory(root, exports, require('underscore'));
} |
Maybe |
I assume this issue can be closed. I switched from grunt.js to a custom build.js file for building the project with webpack and got it all working. As far as I'm aware Phoscur has no issues anymore either. Edit: Actually, |
Hi sokra, I could go nuts: Just tried I checked all, the "vanilla" version, the jam and the npm module. I am not sure if it is save to remove that call. Currently I get the following errors, not sure if that's the actual cause though:
which is, more specifically, the following method from Backbone.View:
I do not think there is a way to fix this, so I just wanted to let you know. I even tried the version that used to work earlier ( Cheers, |
Hi sokra, quick update: I managed to restore an "old" old version of Backbone, which still works. But this is definitely a Cheers, |
Hi, I think you can just replace the Backbone.setDomLibrary(require("jquery"));
// =>
Backbone.$ = require("jquery"); |
Hi sokra, Sorry for the late confirmation - I tried that once, it didn't work. Then I investigated Backbone, realizing that it should work, though. When I gave it a second shot a couple of minutes ago, this resolved my issue. Thanks! Cheers, |
Where should |
You should not modify your dependencies because thus you can't just update them. I'm placing this kind of initialization code in my entry file. The entry file is the file you give to webpack. |
Yes, I was asking because I didn't feel comfortable modificating an On Tue, Oct 15, 2013 at 9:35 AM, Johannes Ewald notifications@github.comwrote:
|
|
@akre54 hm I'll try to force AMD loading then |
Has anyone got any clarifaction on how to fix this issue? Im migrating from RequireJS with Backbone 1.1.0 and i've encountered this problem. |
Hi sokra,
yesterday I tried adding Backbone to one of my projects and ran into some issue I do not fully understand. My setup is
webpack 0.7.8
,Backbone 0.9.2
(both inweb_modules
andnode_modules
, installed locally viajam
ornpm
respectively) andenhanced-require 0.4.0-beta3
running onnode 0.8.11
.When I try to
webpack
a file with the following contentsI get the following warning-error-mix:
Since it is a mere warning, I could force the build though, giving me about what I expected in the console.log line. Nevertheless, did you ever face that warning? How can I get rid of it?
Interestingly enough, when I remove the
jam
version ofBackbone
,webpack
runs without complaining about anything. Then again, there is only theBackbone
namespace in theconsole.log
output, i.e. it containts neitherView
, norModel
, nor any other object or function.Best regards,
Michael
The text was updated successfully, but these errors were encountered: