Skip to content

WIP: Flow example - #49

Open
teh wants to merge 12 commits into
masterfrom
flow-example
Open

WIP: Flow example#49
teh wants to merge 12 commits into
masterfrom
flow-example

Conversation

@teh

@teh teh commented May 24, 2017

Copy link
Copy Markdown
Member

Don't merge, just for illustration.

@amenk

amenk commented Jul 29, 2017

Copy link
Copy Markdown
Collaborator

the current state of the branch is not working .. I have problems with the imports. How can I resolve that? My idea was to try to work on that a bit ...

selection_336

@amenk

amenk commented Jul 29, 2017

Copy link
Copy Markdown
Collaborator

I did the normal build, as documented in the readme.

@amenk

amenk commented Jul 29, 2017

Copy link
Copy Markdown
Collaborator

I did not see the stuff in the branch-readme .. will try

@amenk

amenk commented Jul 29, 2017

Copy link
Copy Markdown
Collaborator

But something seems to be wrong with the lockfile:

yarn install v0.27.5
[1/4] Resolving packages...
error An unexpected error occurred: "Cannot convert object to primitive value".
info If you think this is a bug, please open a bug report with the information provided in "passopolis/extensions/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

when I delete the yarn.lock, yarning works

@amenk

amenk commented Jul 29, 2017

Copy link
Copy Markdown
Collaborator

So I executed

 node_modules/.bin/babel login/ --watch --out-dir build

and then

  nix-build nix/build.nix -A chrome-extension && mkdir -p /tmp/passopolis-chrome && rsync -a result/ /tmp/passopolis-chrome/

Extension is not working...

@teh

teh commented Jul 29, 2017

Copy link
Copy Markdown
Member Author

Hey - yea this definitely doesn't work in its current state. Migration is a non-trivial task because everything needs to be modularized and the code base is not small. I can't remember the details but as you saw imports need to be resolved first by a packer - I hadn't gotten around to that bit yet.

I.e. this branch is not for the faint hearted

@amenk

amenk commented Jul 29, 2017

Copy link
Copy Markdown
Collaborator

Which kind of packer could that be? Does also flow provide such a thing?

@teh

teh commented Jul 29, 2017

Copy link
Copy Markdown
Member Author

I don't know - I hadn't gotten around to that part yet. IIRC even if we can resolve the imports there are still some issues with incomplete flow annotations themselves though I can't quite recall the details.

@amenk

amenk commented Jul 29, 2017 via email

Copy link
Copy Markdown
Collaborator

@Keats

Keats commented Jul 30, 2017

Copy link
Copy Markdown
Member

Those are ES6 imports that can be resolved by webpack, rollup or browserify.

@amenk

amenk commented Jul 30, 2017

Copy link
Copy Markdown
Collaborator

Any preferences which way we should go?

Shall I try webpack? Any objections?

There is already the plugin "transform-es2015-modules-amd" in .babelrc` but this probably does not pack anything together?

@amenk

amenk commented Jul 30, 2017

Copy link
Copy Markdown
Collaborator

The problem seems to be a different one: When nix-building the //@flow files still arrive in the extension, where should be the processed javascript files.

@amenk

amenk commented Jul 30, 2017

Copy link
Copy Markdown
Collaborator
  • in chrome-extension.nix change line 16 to cd build/ (from cd login/) so we are using the actually processed source
  • cp -r build login
  • call babel
  • call nix

Works a bit more, not it does not find the define() statements (Uncaught ReferenceError: define is not defined) - I think for getting those working we need requireJS ? Or would webpack solve this in another way?

@amenk

amenk commented Jul 30, 2017

Copy link
Copy Markdown
Collaborator

I managed to add require.cs to common (then copy it over to build, so it is NOT processed by babel) ... no I get different errors ... but it looks like a good way to go.

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

Successfully merging this pull request may close these issues.

3 participants