Skip to content

Discord Activity build accessing modules beyond the .build folder #428

@dwnppoalt

Description

@dwnppoalt

Running npm run build using robox build produces JavaScript files inside .robo/build/ that contain unresolved deep relative import paths such as:

import { useRoom } from "../../../src/hooks/useRoomContext";

This results in a fatal error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../src/hooks/useRoomContext'

Expected behavior

  • Robo should bundle or rewrite all imports during build.
  • Robo should respect tsconfig.json path aliases (e.g. @/hooks/useRoomContext).
  • At the very least, Robo should copy over all necessary source files to the output folder if it's going to reference them directly.

How to reproduce:

  • Use @/hooks/useRoomContext in a source file.
  • Run robox build.
  • Open .robo/build/context/RoomContext.js or any other generated file.
  • See broken import like:
import { useRoom } from "../../../src/hooks/useRoomContext";
  • Build or deploy fails with ERR_MODULE_NOT_FOUND.

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