Giter Club home page Giter Club logo

Comments (3)

errorrik avatar errorrik commented on May 29, 2024

这个问题出现的原因是:

当遇到define({});这种anonymous define时,loader是不知道这货是啥的,只能先记录下来。所以这种情况,loader只能这么处理,并且所有loader都是这么干的:

  1. 发起一个script src,绑定onload的处理
  2. http返回,script run。这时候define被调用,记录到某个地方
  3. script run完后,onload事件触发。在这里去complete define。步骤1中module id是已知的,所以onload里module id是已知的。拿这个id作为步骤2中define的模块id

esl的实现里,原先是:anonymous define调用时,如果已存在,则后面的都会被忽略
如果要改动,只能变成以后来者为准

换句话说,define在调用时,是没办法知道这个define是有意义还是无意义的,只能更改anonymous define的策略。

from esl.

otakustay avatar otakustay commented on May 29, 2024

确定个事,如果foo.jsbar.js中都有一个define('foo', func...(合并引起的),那么加载这2个js,foofactory会不会就被执行2次了呢?

from esl.

errorrik avatar errorrik commented on May 29, 2024

不会,先到为准

from esl.

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.