Comments (4)
It is the size. Using minified/gzipped numbers, right now requirejs is about 6kb and almond is about 1kb. That difference matters to some folks, particularly if the number of modules are relatively small and they want to package them up as a single file JS library for use by others that may or may not use require.js on their pages.
As you mention though, to get a smaller size it means reduced functionality, so almond is not appropriate for all use cases.
Closing this as part of bug triage, but feel free to continue discussion in this ticket.
from almond.
James to avoid parsing / adding some polyfills to my main js bundle I created a module that load these guys async when necessary
how could I deal with this if I start using Almond ?
if (!Modernizr.geolocation) {
require(['polyfills/pf-geolocation']);
}
// ...
if (!window.JSON) {
return require(['polyfills/pf-json']);
}
from almond.
@pgherveou Almond does not do dynamic loading, so it could not do that on-demand loading. You could include those polyfills in the built file with almond, and if they are wrapped in a define() call, then they will not be executed unless they are part of a top level require dependency call, like the ones you have above. Although note that those require([]) calls finish async.
from almond.
Thks @jrburke, So I guess, It comes down to what's best between
- parsing + file size of Require JS
vs - parsing + file size of Almond & extra files
from almond.
Related Issues (20)
- normalize fails for relative imports with prefixes HOT 7
- Return almond.js as string when required from node.js HOT 2
- How to handle anonymous modules HOT 2
- unsafe String split HOT 3
- can't get requirejs, angularjs and almond to work together HOT 2
- Uncaught Error: No fs HOT 2
- Build problem HOT 2
- AlmondJS + CDN module with UMD HOT 4
- Any way to listen the DOMContentLoaded event HOT 1
- Your js script is crashing Firefox HOT 3
- Issue with relative path when they match such path: "../../vendor/some-lib/./some-file" HOT 1
- Issue with relative path when they match such path: "../../vendor/some-lib/./some-file" HOT 1
- Creating reusable libraries with RequireJS & AlmondJS HOT 1
- Almond + Electron HOT 5
- Loading CSS files HOT 3
- Can almond be forced to require synchronously?
- require.config(...) is being executed too late
- Calander Start With Monday rather than Sunday HOT 1
- Location of almond.js is critical to the build process?
- TypeError: Cannot read property 'splice' of undefined HOT 6
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 almond.