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

elm-webpack-loader appears to be trying to use file without main as an entrypoint #207

Open
alex-tan opened this issue May 16, 2021 · 3 comments

Comments

@alex-tan
Copy link

I'm running into an issue where I have a single entry for my webpack config entry: "./src/index.ts". That file imports a single Elm app import { Elm } from "./App.elm"; but for some reason when I upgraded to "elm-webpack-loader": "^8.0.0" from the elm-webpack-starter I've started seeing it attempt to compile an additional file in my src/ directory called src/Events.elm. This causes the elm compiler to complain with

Note: Adding a `main` value can be as brief as adding something like this:

import Html

main =
  Html.text "Hello!"

Which is strange because there are other elm files in the root of the src directory that it doesn't seem to care about.

I attempted to debug the issue by specifying the files option to be ['src/App.elm'] which resolves the issue but causes each save to trigger 3 compilations in the terminal.

If anyone has any hunches about why this might be happening it would be much appreciated.

@simonh1000
Copy link
Contributor

does that file have anything named main - even an in-line let statement

@alex-tan
Copy link
Author

No, nothing called main in that file. I ended up resolving the issue by moving the file to a nested directory, though didn't figure out what was causing the issue.

@simonh1000
Copy link
Contributor

In my case, this line

import { getDimensions } from "../../../shared/Runtime/runtime.js";

was leading webpack to attempt to compile ../../../shared/Runtime/Runtime.elm and this file does not have main in it

This elm file was imported by by Elm entry point but not sure whether that matters - comment the above line out, or renaming to RuntimeSOMETHING.elm seems to be a workaround

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