Roblox / Roblox/react-luau

Package published on Wally registry is not functional

Open Beginner friendly
#27 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Luau
Stars
568
Forks
49
PR merge metrics
No merged PRs in 30d

Description

When I execute:

local React = require(ReplicatedStorage.Shared.Packages.react)

I get the error:

Attempted to call require with invalid argument(s).

Due to the script at ReplicatedStorage.Shared.Packages.react containing the following require statement:

return require(script.Parent._Index["roblox_react@17.3.11"]["react"])

Which does not lead to a module script! It leads to a folder, which then has a module script under src. (an init file, so src itself is considered a module script in Roblox Studio)

How the file hierarchy looks for the packages, as generated by Wally:

Image

It seems as if the packages are not aware that they are still within a src file, and assume they're in their "Packages" file, as they seem to call it.

See the init.lua source file for the roblox-react package:

--!strict
-- ROBLOX upstream: https://github.com/facebook/react/blob/56e9feead0f91075ba0a4f725c9e4e343bca1c67/packages/react/src/index.js
--[[*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 *]]

-- ROBLOX deviation: simulates `index.js` and exports React's public interface
local Packages = script.Parent
local LuauPolyfill = require(Packages.LuauPolyfill)
export type Object = LuauPolyfill.Object

The line that initializes the Packages variable should be the following:

local Packages = script.Parent.Parent

instead of:

local Packages = script.Parent

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the roblox-react package's init.lua and inspect the Wally-generated hierarchy shown in the issue, then trace how the package resolves Luau requires from its published location. Verify the package through the reported ReplicatedStorage.Shared.Packages.react require path; done means it resolves to a module and loads without the invalid-argument error.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, react
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.