Skip to content

import an mjs file twice at the same time cause an error #1149

@steve02081504

Description

@steve02081504

Version: Deno 2.3.6

if you load an mjs file twice at the same time youll get an error like this:

Skipping fount update due to .noupdate file
deno 2.3.1+92cdce1
standing by...
fo-fo-fo-fo-fo-fount!
正在重启用户 steve02081504 的 Shell discordbot 任务:GentianAphrodite
HTTP 服务器运行在 http://localhost:8931
运行 shell preload 作为 steve02081504,参数:["chars","GentianAphrodite"]
Socket 错误: Error: read ECONNRESET
steve02081504 chars GentianAphrodite
Trace
    at loadPartBase (file:///C:/Users/steve02081504/workstation/fount/src/server/parts_loader.mjs:240:11)
    at async Object.LoadChar [as chars] (file:///C:/Users/steve02081504/workstation/fount/src/server/managers/char_manager.mjs:27:15)
error: Uncaught (in promise) ReferenceError: Cannot access 'default' before initialization
        const part = (await import(url.pathToFileURL(path + '/main.mjs'))).default
                                                                           ^
    at baseMjsPartLoader (file:///C:/Users/steve02081504/workstation/fount/src/server/parts_loader.mjs:72:69)
    at async Loader (file:///C:/Users/steve02081504/workstation/fount/src/server/parts_loader.mjs:200:16)
    at async loadPartBase (file:///C:/Users/steve02081504/workstation/fount/src/server/parts_loader.mjs:232:59)
    at async Object.LoadChar [as chars] (file:///C:/Users/steve02081504/workstation/fount/src/server/managers/char_manager.mjs:27:15)

Even if the second load is not caused by loading mjs itself (in other words, it does not constitute a self-reference), it will cause an error.
I would expect both promises to wait until the mjs file is loaded.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions