elm-lang / elm-make

A build tool for Elm projects
BSD 3-Clause "New" or "Revised" License
175 stars 45 forks source link

0.18 alpha: elm-make fails to generate correct JS when animation-frame is installed #119

Closed eeue56 closed 7 years ago

eeue56 commented 7 years ago

The code: https://gist.github.com/eeue56/e2f9d66fb8ae6dbaec5bd1a976d4d4e6

elm-package.json

{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/animation-frame": "1.0.1 <= v < 2.0.0",
        "elm-lang/core": "5.0.0 <= v < 6.0.0",
        "elm-lang/html": "2.0.0 <= v < 3.0.0"
    },
    "elm-version": "0.18.0 <= v < 0.19.0"
}

Main.elm

import Html exposing (..)

main = text "hello"

Problem

Run elm-make Main.elm when animation-frame is in the package file.

Expected output:

A HTML page with hello displayed.

Actual output:

An error on line 1740 of the generated JS:Uncaught TypeError: Cannot read property 'fromArray' of undefined

Possible solution

process-bot commented 7 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

evancz commented 7 years ago

I'm not sure if this is the ideal fix, but it works. Here is my assessment:

Feel free to say something if this seems like a bad move for some specific reason.

eeue56 commented 7 years ago

My only comment is that broken imports for Native seems to come up fairly often (in 0.17 there was the Json.Encode issue), so it might be worth investing some time into a js import system. This move seems fine for now though.

nphollon commented 7 years ago

Importing animation-frame still does not work. The error I am getting (for Noah's same sample program) is

TypeError: _elm_lang$core$Native_Scheduler is undefined

Should we re-open this issue, or should I create a new one?

evancz commented 7 years ago

New one with SSCCE would be best!