add failing test for most basic hello world app #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
getBaseDir
function fails for main elm files that do not have an explicit module statement in the first line, such as the most basic possible hello world program.The failing test results in the following error being thrown:
The contents of SimplestMain.elm is
This is clearly a valid Elm program, and running elm-make on it manually will succeed.
I arrived at this issue by following the source from elm-webpack-loader.
https://github.com/rtfeldman/elm-webpack-loader/blob/555334261b1263f2cc43e14b0b708b80774d84b0/index.js#L45, calls findAllDependencies from "node-elm-compiler": "4.1.1", and does not specific the baseDir argument. Thus, findAllDependencies tries to figure out the baseDir but fails on the the hello world program as it expects a first line containing "module".
The follow on effect when used with elm-webpack-loader is that the program will compile the first time successfully, but any changes to dependent files are not picked up by the watch functionality of webpack.
I'm not sure if the problem should be solved in elm-webpack-loader (should it be passing a baseDir argument?).
This might be the problem that OP is seeing in elm-webpack-starter: elm-community/elm-webpack-starter#27