Comments (9)
I can reproduce your test case with your zip file. Thank you!
Knockback is packaged in a UMD2 format using webpack which should support most common loading schemes...see this configuration file.
There might three reasons:
-
The libraries are adding themselves to window when loaded through AMD
-
Webpack is adding them to window when loaded through AMD. I've looked at the code generated by webpack and it looks like there is a function for these external references webpackLoadOptionalExternalModuleAmd. Have you stepped into that to see what it does?
-
I am added them to window. I don't see anywhere in my code where I'm putting things on window. See here where I cache the references internally.
If it is a problem for you rather than just an inconvenience, can you step through your code and pinpoint where they are added to window?
from knockback.
Hi,
I have looked over your code and couldnt find anything. Dont take my
word for it, I'm still new to the javascript world :)
I dont believe its Knockout.js fault (point 1)) because if you load it
without backbone, window.ko stays undefined.
I have partially read the Webpack code that you pointed out but without
success :).
But I do think thats Webpack fault.
I dont have any problem with it right now but I thought as a principle
that one library should never impact the behavior of an other.
It seems you already had some difficulties to properly configure Webpack :P
webpack/webpack#424
Le 22/01/2016 18:05, Kevin Malakoff a écrit :
I can reproduce your test case with your zip file. Thank you!
Knockback is packaged in a UMD2 format using webpack which should
support most common loading schemes...see this configuration file
https://github.com/kmalakoff/knockback/blob/master/config/builds/library/knockback.webpack.config.coffee.There might three reasons:
The libraries are adding themselves to window when loaded through AMD
Webpack is adding them to window when loaded through AMD. I've
looked at the code generated by webpack
https://github.com/kmalakoff/knockback/blob/master/knockback.js#L13
and it looks like there is a function for these external references
webpackLoadOptionalExternalModuleAmd. Have you stepped into that to
see what it does?I am added them to window. I don't see anywhere in my code where
I'm putting things on window. See here
https://github.com/kmalakoff/knockback/blob/master/src/core/kb.coffee#L224
where I cache the references internally.If it is a problem for you rather than just an inconvenience, can you
step through your code and pinpoint where they are added to window?—
Reply to this email directly or view it on GitHub
#148 (comment).
Ludilabel Ludilabel Restant à votre entière disposition.
Bien cordialement.
Franz BUDON
Tel. 05 34 66 11 23
ludilabel.fr http://www.ludilabel.fr/
Rejoignez nos 75 000 fans
sur Facebook : facebook.com/ludilabel.fr
https://www.facebook.com/ludilabel.fr
from knockback.
Thanks for looking into this.
If it is in webpack and actually doesn't do anything bad functionally, I would probably just let it slide. It might be a lot of work to fix it in webpack....
from knockback.
This is a knockback.js issue. Just ran into this and its a bit disappointing.
At line 3100 of knockback-core.js (version 1.1.0)
if (typeof window !== "undefined" && window !== null) {
ref = ['_', 'Backbone', 'Parse', 'ko', '$'];
for (i = 0, len = ref.length; i < len; i++) {
key = ref[i];
if (kb[key] && !Object.prototype.hasOwnProperty.call(window, key)) {
window[key] = kb[key];
}
}
}
Here the knockback dependencies are actually all being added to the window. There is also a similar issue where amd/commonjs conventions are broken at line 821 (same file)
kb.$ = window.jQuery || window.$;
try {
kb.$ || (kb.$ = __webpack_require__(7));
} catch (undefined) {}
Here kb.$ is pulling from the window first and then falling back to require. IMO it should be doing the require first. In my testing, I was finding that this can load an incorrect version of jQuery.
from knockback.
@ambiguousFoo there was a reason in some configuration. I think maybe jQuery and Parse were't playing nice with some loaders. Mind you, that was many years ago before module systems were common...
You can find the lines pulling dependencies from or putting dependencies on window here, here, and here.
I can try a build without any of the exposing...
from knockback.
Try the version in master and let me know if it works for you.
from knockback.
@ambiguousFoo and @franzludilabel. With 1.2.0, Knockback doesn't republish the internal symbols for underscore, Backbone, and Knockout (although Backbone will add itself inside its library to window, but I cannot do anything about that).
Also, references to jQuery have been removed from Knockback.
from knockback.
from knockback.
@franzludilabel thank you for the kind words and sharing a link to your work. Looks great!
from knockback.
Related Issues (20)
- LocalStorage problems HOT 3
- 'Knockback' and 'kb' are not interchangeable HOT 14
- AmpersandJS support HOT 7
- collection filters and viewModel caching HOT 7
- Knockout 3.4 deferred updates HOT 5
- What's the state of support for LoDash 4? HOT 3
- Please consider officially supporting NestedTypes HOT 2
- Having more models in a viewmodel when using "factories" HOT 4
- Is there a way to observe an object attribute without it being converted to a ViewModel? HOT 4
- kb.Store::retainOrCreate() calls kb.Store::retain() twice when 'creating' and never when 'retaining' HOT 13
- collectionObservable does not increment length or notify subscribers HOT 11
- Doc Needs to Be Updated HOT 2
- "Cannot read property '_subscribable' of undefined" in kb.renderTemplate HOT 13
- inputValidator attaches required validator even if there is no required attribute HOT 4
- Manually created observables doesn't work if initially created with model = null HOT 5
- During init, observable is not validatable if html5 validation attributes have been specified HOT 1
- Webpack 3+ and Knockback HOT 2
- Assigning new model to viewmodel updates properties of wrong model
- Replacing model breaks the data-bindings HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knockback.