@lynx-js/react / import-attributes
runtime: 'shared'通过 Import Attributes 显式声明某些模块可以在主线程和后台线程之间共享。仅用于使用 主线程函数(Main Thread Function) 的场景。详情请参考跨线程共享模块。
import 语句的 with 从句中的 runtime 属性用于指定导入模块的运行时行为。当设置为 'shared' 时, 该模块将被标记为跨线程共享。
runtime: 'shared'import ... with { runtime: 'shared' } 引入的标识符才能被识别为共享。MainThreadRef),除非显式标记 'main thread'。