Elm
You can import Elm files like any another JavaScript files.
The npm package elm
needs to be manually installed beforehand. You'll also need a elm.json
configuration file (run yarn elm init
to get started and modify it if necessary).
Compiling multiple files into a single JS output
#You can use the with
query param to compile multiple Elm sources into the same bundle. This can help you keep the bundle size smaller, because things like the runtime and common code are shared.
This will do the equivalent of this command:
elm make Main.elm MainB.elm MainC.elm
The with
param can be used multiple times to include multiple extra Elm programs.
Beware of 2 things:
- Path base: The paths given in the
with
param values are relative to the directory of the first file in theimport
statement (in this caseMain.elm
), NOT relative to the JS file that contains theimport
statement. - Unintentional Duplication: Multiple imports that effectively specify the same Elm files but in a different order (or differ regarding leading
./
, etc.) are treated as different assets (and will therefore be duplicated)
Time-travelling debugger
#Elm's debug mode is automatically enabled when not building for production (it is disabled automatically with parcel build
). You can set the environment variable PARCEL_ELM_NO_DEBUG=1
to disable it even in development mode.