Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Example code of 'How to run Prepack' doesn't work #781

Closed
echo304 opened this issue Jul 4, 2017 · 2 comments
Closed

Example code of 'How to run Prepack' doesn't work #781

echo304 opened this issue Jul 4, 2017 · 2 comments

Comments

@echo304
Copy link
Contributor

echo304 commented Jul 4, 2017

When I tried to run example code of How to run Prepack I got an error like below.

$ echo "function hello() { return 'hello'; } function world() { return 'world'; } s = hello() + ' ' + world();" >/tmp/sample.js
$ cat /tmp/sample.js | yarn prepack
yarn prepack v0.24.5
$ node lib/prepack-cli.js
No sourcemap found at .
/Users/SB/personal/prepack/lib/prepack-cli.js:200
      console.log(serialized.code);
                            ^

TypeError: Cannot read property 'code' of null
    at processSerializedCode (/Users/SB/personal/prepack/lib/prepack-cli.js:200:29)
    at ReadFileContext.callback (/Users/SB/personal/prepack/lib/prepack-node.js:69:7)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:366:13)
error Command failed with exit code 1.

I've figured out that this LOC returns null as first argument which follows a convention of error first callback.
Is it intentional implementation or just a bug? Can I tackle it and make PR?

@hermanventer
Copy link
Contributor

Please do.

facebook-github-bot pushed a commit that referenced this issue Jul 6, 2017
Summary:
Since example code of [How to run Prepack](https://github.com/facebook/prepack#how-to-run-prepack) doesn't work(#781 )
I fixed `processSerializedCode` function to handle error as 1st argument
which follows 'error first callback' convention.
And to verify the changes I've added test code for the case of `StdIn`
Closes #784

Differential Revision: D5375275

Pulled By: NTillmann

fbshipit-source-id: ea85d0f30db4305aa7fcb5b69bf28f5998a84962
@NTillmann
Copy link
Contributor

Fixed by referenced commit. Thanks, @echo304!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants