GithubHelp home page GithubHelp logo

Comments (6)

gustavnikolaj avatar gustavnikolaj commented on May 26, 2024

I have seen the same error in an application at work. We're fine with this not being supported, but we just want it to throw an exception. That makes it possible to debug it and more easily identify the situation.

from almond.

avalez avatar avalez commented on May 26, 2024

I would prefer logging warning, and supporting unidentified modules.

from almond.

gustavnikolaj avatar gustavnikolaj commented on May 26, 2024

@avalez, that is outside the scope of almond. You should use require.js if that is your usecase. See the restrictions part of the readme.

all modules have IDs and dependency arrays in their define() calls -- the RequireJS optimizer will take care of this for you.

from almond.

avalez avatar avalez commented on May 26, 2024

Requirejs throws http://requirejs.org/docs/errors.html#mismatch I would not like to use RequireJs optimizer in development, but also in production. Hopefully almond can workout anonymous id as ReqiureJS does.

from almond.

gustavnikolaj avatar gustavnikolaj commented on May 26, 2024

Almond is not meant to be used without your app being run through RequireJs Optimizer first. It's something that can replace RequireJs once that it is built and you can make more assumptions about the code. If you need this, you should not be using almond in the first place, but stick with RequireJs.

from almond.

jrburke avatar jrburke commented on May 26, 2024

@gustavnikolaj is correct, almond is only for use with built code, and for that built code to work all the define() calls need IDs. requirejs can work with anonymous modules if there is only one anon module per file and if that file is dynamically loaded. Since almond does not support dynamic loading, that is not possible in almond.

As for a better error, in the interests of keeping the code small, it would just be a throw of an Error but would not really tell what module triggered it, where that define() came from, so I am not so sure it is worth adding to the size of almond for it.

However, I am open to discussing an error that makes sense, maybe it just points to an almond wiki explaining the issue. Just want to be sensitive to how much space that takes up in almond vs its benefit, and we should have that discussion on a separate ticket from this one.

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.