react-lua
react-lua copied to clipboard
Fix import of ../utils and ./utils
I'm only able to get devtools to run (with rojo translating ../utils to script.Parent.Parent:WaitForChild('utils') if I change this in react-devtools-shared/src/backend/renderer.luau :
#ocal utils = require(script.Parent:WaitForChild('utils')) # does not work
local utils = require(script.Parent.Parent:WaitForChild('utils')) # does work
So, I think it should be this, because getUID() is in utils not backend/utils:
local utils = require("../utils")
https://github.com/jsdotlua/react-lua/blob/df4b4072e3aa78fc64850f8ca8b696084f305d75/modules/react-devtools-shared/src/backend/renderer.luau#L53-L70
Otherwise getUID() and getDisplayName() etc are nil.
FWIW I'm running devtools with this
-- init.client.lua
-- [...]
print("DEBUG: init.client: starting...")
-- Instead of running tests:
-- _G.runTests = game:GetService("RunService"):IsStudio()
-- Interactive debugging!
_G.__DEV__ = false
_G.__DEV__ = game:GetService("RunService"):IsStudio()
print(string.format("DEBUG: init.client: _G.__DEV__=%s", tostring(_G.__DEV__)))
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--local debugMode = true
--local debugMode = false
local debugMode = game:GetService("RunService"):IsStudio()
if debugMode then
local ReactDevtools = require(ReplicatedStorage.DevPackages.ReactDevtools);
ReactDevtools.setup(debugMode)
end
-- ~=
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.Packages.ReactRoblox)
local appRootModel = Instance.new("Folder")
appRootModel.Name = "AppRoot1"
appRootModel.Parent = workspace
appRoot = ReactRoblox.createRoot(appRootModel)
appRoot:render(React.createElement("Part", {key="Part1"}) -- ~=