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

--port is broken in 0.12 #3387

Closed
paf31 opened this issue Jun 20, 2018 · 4 comments
Closed

--port is broken in 0.12 #3387

paf31 opened this issue Jun 20, 2018 · 4 comments

Comments

@paf31
Copy link
Contributor

paf31 commented Jun 20, 2018

Looks like the require changes broke it.

@omefire
Copy link

omefire commented Jun 27, 2018

I can help with this.

@Cmdv
Copy link
Contributor

Cmdv commented Oct 3, 2018

as per Slack conversation the code for this lives:
app/Command/REPL.hs and src/Language/PureScript/Interactive*

unsure what the require changes were though.

edit:

I think there's a require shim somewhere in the code that the websocket psci version sends to the browser that probably can't handle the added .js

It calls bundle https://github.com/purescript/purescript/blob/master/app/Command/REPL.hs#L122 which without looking into it seems odd as that presumably works for standalone bundle
If I was looking at this 1st step would be to repro and find out what's going wrong specifically before looking at code.

@dariooddenino
Copy link
Contributor

dariooddenino commented Oct 3, 2018

What's the correct way to debug this?
What are the correct steps to build and then call the newly built purs instead of the one installed on my system?

I'm also looking at the repl tests to see if I can replicate this there.

Thanks!

EDIT:
If I got this right, the problem is in this generated code:

    var replaced = js.replace(/require\("[^"]*"\)/g, function(s) {
        return "PSCI['" + s.substring(12, s.length - 2) + "']";
    });

which leaves a trailing /index.js for each required module.
A very crude test in chrome done by modifying the 2 into an 11 removes all errors from the repl.

I'm not sure how the interaction between the repl and the browser is supposed to work though. So I'm not sure if this actually fixes the issue (obviously changing the code in chrome is not a real fix :D)

hdgarrood added a commit that referenced this issue Feb 17, 2019
hdgarrood added a commit that referenced this issue Feb 17, 2019
Thanks to @dariooddenino for tracking down what the problem was.

Co-authored-by: Dario Oddenino <dariooddenino@users.noreply.github.com>
@hdgarrood
Copy link
Contributor

@dariooddenino thanks for this! In case you didn't work it out, for building and running a version of purs from a local working copy, I'd recommend doing stack build --fast to build it, and then stack exec bash to put yourself into a new shell session with the newly built purs at the front of your PATH.

hdgarrood added a commit that referenced this issue Feb 17, 2019
Thanks to @dariooddenino for tracking down what the problem was.

Co-authored-by: Dario Oddenino <dariooddenino@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants