Registry / devops / elm-webpack-loader

elm-webpack-loader

JSON →
library8.0.0jsnpmunverified

Webpack loader for the Elm programming language. Version 8.0.0 supports Webpack 5. Actively maintained by elm-community. Tracks Elm dependencies and watches them in watch mode. Recommended to set cwd option to the directory containing elm.json. Supports debug and optimize modes, runtime options for profiling, and multiple file bundling. Peer dependency on Elm 0.19.1-3 or 0.19.0-no-deps.

npm install elm-webpack-loader
INSTALL
IMPORT
SIG · ELM-WEBPACK-LOADER
E
elm-webpack-loader
devopsjavascriptv8.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Elm
import Elm from './Main.elm'
import { Elm } from './Main.elm'
Default import returns the Elm object with module initializers.
Elm.Main
import Elm from './Main.elm'; Elm.Main.init({node: document.getElementById('main')})
import { Main } from './Main.elm'
default (import)
const Elm = require('./Main.elm')
const { Elm } = require('./Main.elm')
CommonJS require returns the default object.

Minimal webpack configuration to process Elm files using elm-webpack-loader with the recommended cwd option.

// webpack.config.js const path = require('path'); module.exports = { module: { rules: [{ test: /\.elm$/, exclude: [/elm-stuff/, /node_modules/], use: { loader: 'elm-webpack-loader', options: { cwd: path.resolve(__dirname, 'src') } } }] }, resolve: { extensions: ['.elm'] } };
Debug
Known issues
breakingVersion 8.0.0 drops Webpack 4 support. Webpack 5 is required.
fix
Upgrade to Webpack 5.
affects: >=8.0.0
deprecatedThe 'pathToElm' option is deprecated and will be removed. Use 'cwd' instead.
fix
Replace pathToElm with cwd option.
affects: >=6.0.0
gotchaIf you don't set the 'cwd' option, the loader may not find elm.json and will compile from the current working directory.
fix
Set cwd to the directory containing elm.json.
affects: >=6.0.0
gotchaThe 'files' option only works when using object-style loader configuration, not inline or CLI.
fix
Use object-style configuration for loader options.
affects: >=0.0.0
gotchaUsing the 'runtimeOptions' requires a custom Elm binary built with -rtsopts enabled. Default Elm binary doesn't support it.
fix
Build elm-make from source with -rtsopts flag.
affects: >=6.0.0
Errors
Common errors & fixes
Error: 'elm' is not recognized as an internal or external command
Elm compiler not installed globally or in project dependencies.
fix
Run 'npm install --save-dev elm' to install elm package.
Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type.
Webpack not configured to process .elm files.
fix
Add the elm-webpack-loader rule to webpack configuration.
Cannot find module 'elm'
Elm package is not installed as a dependency.
fix
Install elm as a dev dependency: 'npm install --save-dev elm'.
Upgrade
Version history
8.0.0latest on npm
Audit
Dependencies
elmrequiredPeer dependency: Elm compiler version 0.19.1-3 or 0.19.0-no-deps required
Agent activity
4 hits · last 30 days
node
4
Resources
elm-webpack-loader — npm install elm-webpack-loader · libregistry