madsflensted / elm-brunch

Brunch plugin to compile Elm code
MIT License
74 stars 31 forks source link

relative path executablePath #34

Closed slashmili closed 6 years ago

slashmili commented 7 years ago

Problem

I'm trying to use executablePath in elm-brunch to run local installed elm.

The problem that I have this plugins fails to run elm-make

Elm compile: Main.elm, in elm, to ../static/vendor/main.js
/bin/sh: node_modules/elm/binwrappers/elm-make: No such file or directory
21:03:54 - error: Command failed: node_modules/elm/binwrappers/elm-make --yes --output ../static/vendor/main.js Main.elm

It does work if I make this change into index.js :

<       const executable = path.join(executablePath, 'elm-make');
---
>       const executable = process.cwd() + "/" + path.join(executablePath, 'elm-make');

Is it possible to check the executablePath and if it's relative path use this patch otherwise use it as it is? something like this :

<       const executable = path.join(executablePath, 'elm-make');
---
>       if(isRelativePath(executablePath)) {
>           const executable = process.cwd() + "/" + path.join(executablePath, 'elm-make');
>       } else {
>           const executable = path.join(executablePath, 'elm-make');
>       }

Information

madsflensted commented 6 years ago

The executablePath is relative to the elmFolder path configuration. Have you checked if you need a ../ ?

slashmili commented 6 years ago

I have moved my project to elm-app

Don't have the setup anymore to test ../ :(