Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to reload TypeScript files #1

Open
lostfictions opened this issue Dec 14, 2020 · 2 comments
Open

Error when trying to reload TypeScript files #1

lostfictions opened this issue Dec 14, 2020 · 2 comments

Comments

@lostfictions
Copy link

Hey there -- I realize this is obviously isn't the fault of your type definitions, but I'm getting an odd error when I try to use Lurker and modify my TypeScript files (while running tstl -p tsconfig.json --watch):

[lurker] Hotswapping 'conf.lua'...
[lurker] Swapped 'conf.lua' in 0.00053299999999989 secs
[lurker] Hotswapping 'guy.lua'...
[lurker] Swapped 'guy.lua' in 0.001142 secs
[lurker] Hotswapping 'lualib_bundle.lua'...
[lurker] Failed to swap 'lualib_bundle.lua' : node_modules/lume/lume.lua:693: table index is nil

Oddly, if I modify the output Lua files directly, things seem to work fine (more or less -- it doesn't crash, but it doesn't always seem to hotswap correctly).

Do you happen to have any insights about what might be happening?

@lostfictions
Copy link
Author

lostfictions commented Dec 14, 2020

This seems to fix the issue for me:

import lurker = require("lurker");
lurker.preswap = (f) => f === "lualib_bundle.lua";

For whatever reason, tstl's support library seems to choke Lurker.

@hazzard993
Copy link
Owner

Thanks for the find!

Looks like lurker can't hotswap code like this:

local Symbol = {}
Map = {}
Map[Symbol] = Map

Not sure if this is a bug with lurker, but the lualib_bundle uses code like this to define classes

So it looks like your solution is the best one for this issue since lurker currently can't handle hotswapping the lualib_bundle

I'll add this step to the README

hazzard993 added a commit that referenced this issue Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants