Giter Site home page Giter Site logo

Advantage over RequireJS about almond HOT 4 CLOSED

requirejs avatar requirejs commented on August 16, 2024
Advantage over RequireJS

from almond.

Comments (4)

jrburke avatar jrburke commented on August 16, 2024

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.

pgherveou avatar pgherveou commented on August 16, 2024

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.

jrburke avatar jrburke commented on August 16, 2024

@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.

pgherveou avatar pgherveou commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.