Skip to content

Fable splitter doesn't put /big.js in output #1751

Closed

Description

@forki

I'm trying to convert my React Native project from fable 1.x to fable 2.x but fable-splitter doesn't put big.js into my out folder. Any ideas what I can try?

image

Activity

  1. forki commented on Feb 21, 2019

    @forki
    CollaboratorAuthor

    so that big.js file is correctly copied into .fable folder as part of fable-library.2.1.12 but it's not put into out

  2. forki commented on Feb 21, 2019

    @forki
    CollaboratorAuthor

    @alfonsogarciacaro I wonder if that's related to TypeScript being involved?

  3. forki commented on Feb 21, 2019

    @forki
    CollaboratorAuthor

    BigInt folder isn't copied as well. So I assume it's only copying the top-level?

  4. alfonsogarciacaro commented on Feb 22, 2019

    @alfonsogarciacaro
    Member

    fable-splitter is used to compile the tests and they include decimal tests (which require the big.js dependency). Do you have a small repro of your problem?

  5. forki commented on Feb 22, 2019

    @forki
    CollaboratorAuthor
  6. forki commented on Feb 26, 2019

    @forki
    CollaboratorAuthor

    I think I found a probably related bug:

    1. clone https://github.com/SAFE-Stack/SAFE-Nightwatch
    2. checkout fable2 branch
    3. run build.cmd debug

    now look into out folder. I'd expect BigInt would be copied into fable-library.2.2.0-beta-012 folder. But it's directly in out. Something is weird here.

  7. alfonsogarciacaro commented on Feb 26, 2019

    @alfonsogarciacaro
    Member

    fable-splitter flattens the folder structure, this is done mainly to avoid issues with folders coming from an external directory. If the import paths within the files are correct (which should be the case) this is not a problem. (However @ncave has "fixed" this for fable-compiler-js, maybe it could be fixed here too.)

    I can see out/lib/big.js after running fable-splitter so it seems to work. I cannot run the app though because I don't have Android SDK installed in my machine.

    Also, please note big.js is not about BigInts but Decimal.

  8. forki commented on Feb 26, 2019

    @forki
    CollaboratorAuthor

    image

    I mean the BigInt folder - and it's not flattened at all. it's just that the subfolders are now outside of the original folder (and in the work project they aren't copied at all)

  9. ncave commented on Feb 26, 2019

    @ncave
    Collaborator

    @forki Yes, that's what @alfonsogarciacaro means by flattened folder structure - just one level deep, so all the subfolders are brought at top level. That's how the splitter was always working.

    If you want to experiment with a different folder structure, the fable-compiler-js (@next) tries to strike a better balance and retain the original folder structure to the extent possible (within reason, as it has to move any external dependencies into the output somehow, so not possible if we don't want to recreate full absolute paths under the output folder, which would work but it will be too deep IMO).

  10. forki commented on Feb 26, 2019

    @forki
    CollaboratorAuthor
  11. forki commented on Feb 27, 2019

    @forki
    CollaboratorAuthor

    image

    getting some warnings about the same lib. is that related?

  12. forki commented on Feb 27, 2019

    @forki
    CollaboratorAuthor

    I found something in the log output. In the SAFE-Nightwatch it looks ok:

    image

    In my own project it forgets about the requires:

    image

  13. forki commented on Feb 27, 2019

    @forki
    CollaboratorAuthor

    Ok. here is a repro:

    msu.Reading.zip

    1. extract the zip
    2. yarn install
    3. yarn run fable-splitter -c splitter.config.js --define DEBUG

    image

    As you can see it compiles the Decimal.js - which itself has that gnarly require. But the big.js is not put into out folder

  14. forki commented on Feb 28, 2019

    @forki
    CollaboratorAuthor

    @alfonsogarciacaro I updated to 2.2.0-beta-014 in my production app and it seems to be fixed. Is there something that might have caused that?

  15. alfonsogarciacaro commented on Feb 28, 2019

    @alfonsogarciacaro
    Member

    In principle I'd say no, unless this commit had something to with adding an import to Decimal.ts: 53fcc7a

    In any case, if it's fixed let's call it a day :)

  16. forki commented on Feb 28, 2019

    @forki
    CollaboratorAuthor

    ;-)

  17. forki commented on Mar 12, 2019

    @forki
    CollaboratorAuthor

    ok with 2.2.0-beta-016 I see that issue again

  18. reopened this on Mar 12, 2019
  19. alfonsogarciacaro commented on Mar 14, 2019

    @alfonsogarciacaro
    Member

    Apparently the problem was the babel.config.js file. Babel was reading it when parsing JS files so the AST was different from expected, and the import paths couldn't be adjusted. Can you please try with fable-splitter 2.1.6?

  20. forki commented on Mar 15, 2019

    @forki
    CollaboratorAuthor

    cool, seems to work! thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions