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

any way to disable automatic bsb compilation? #32

Closed
codekiln opened this issue Feb 4, 2018 · 5 comments
Closed

any way to disable automatic bsb compilation? #32

codekiln opened this issue Feb 4, 2018 · 5 comments
Assignees

Comments

@codekiln
Copy link

codekiln commented Feb 4, 2018

I'm working on a react native app with Reason, and I'd like to handle bsb compilation myself. I'd love to have some ReasonML syntax highlighting, but until ReasonReact is supported, I need to disable the ReasonML plugin looking for and attempting to do things with bsb. Is there any way to do this?

@giraud
Copy link
Owner

giraud commented Feb 4, 2018

ok, I will add a property for that.
But may I ask you the reason why is it not working for you ?

@codekiln
Copy link
Author

codekiln commented Feb 4, 2018

Thank you! Here's an explanation of the setup that led to this request:

I put the following in Help > Edit Custom VM Options:

-DreasonBsb=/usr/local/bin/bsb
-DreasonRefmt=/Users/pnore/.config/yarn/global/node_modules/.bin/refmt

Then I restarted jetbrains and tried to make a new Reason React Native Scripts project. I use yarn start to start the server, then quit the reason react native bsb process to try to let your plugin compile the reason. When I edit a Reason source file, I get:

refmt errors

In addition, in the react native server console, I get:

:51:54 AM: Failed building JavaScript bundle
8:51:54 AM: Unable to resolve ../../../../lib/js/src/App" from ".//node_modules/reason-react-native-scripts/build/bin/crna-entry.js`: could not resolve `/Users/pnore/dev/react/HelloWorldRe/lib/js/src/App' as a file nor as a folder","name":"UnableToResolveError","type":"UnableToResolveError","errors":[{}]},"type":"bundling_error"}"

If I uninstall the plugin, and do yarn start, then everything recompiles upon saves just fine.

So that's why. If you know of a different way around this so I can keep using the plugin, please let me know!

@giraud
Copy link
Owner

giraud commented Feb 4, 2018

It's strange, refmt is no more automatically run. what is the version of your plugin ?

I think that it's not a good idea to run bsb in a node script. The compilation phase should stay in the IDE, this way we can trigger/monitor this external compilation process. For ex, if you stop using bsb in intellij , you won't have the annotations in your sources, like here:

hint

it's not perfect yet, but it's helpful to locate the error quickly.

If you don't include neither of the bsb and remft properties, you will still get the syntax coloration.

@giraud
Copy link
Owner

giraud commented Feb 6, 2018

in v0.38, you can use the property reasonBsbDisabled. add -DreasonBsbDisabled=true in your vm.properties file

@giraud giraud closed this as completed Feb 6, 2018
@codekiln
Copy link
Author

codekiln commented Feb 8, 2018

Thank you! I think this feature may prove helpful, though at your advice I tried again, and ended up fixing my setup to work with this plugin by removing the global vmoption pointers to refmt and bsb, and instead ensuring my .bsconfig.json was configured the way that I wanted. In my case, I'm using:

  "package-specs" : [{
    "module": "es6",
    "in-source": true
  }]

along with webpack, and the plugin is now working with .bsconfig.json to compile ES6 modules that alongside my .re files, which webpack then uses to create its bundles.

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