Skip to content

模块规范中 define() 的 factory 可以是 string 吗? #48

@conwnet

Description

@conwnet

factory可以是任何类型,一般来说常见的就是三种类型function, string, object。当factory不是function时,将直接做为模块对象。

The third argument, factory, is a function that should be executed to instantiate the module or an object. (-- amdjs/amdjs-api)

您好,我测试 RequireJS 中,如果 factory 直接是一个 String 的话,是无法得到理想的效果的。
看了 esl 和 RequireJS 的源码,如果 define 第一个参数是 string 的话,就会被当做 string 了。
请问 define() 的 factory 可以是 string 吗?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions