{"id":21208,"library":"elm-webpack-loader","title":"elm-webpack-loader","description":"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.","status":"active","version":"8.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/elm-community/elm-webpack-loader","tags":["javascript","elm","webpack","loader"],"install":[{"cmd":"npm install elm-webpack-loader","lang":"bash","label":"npm"},{"cmd":"yarn add elm-webpack-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add elm-webpack-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: Elm compiler version 0.19.1-3 or 0.19.0-no-deps required","package":"elm","optional":false}],"imports":[{"note":"Default import returns the Elm object with module initializers.","wrong":"import { Elm } from './Main.elm'","symbol":"Elm","correct":"import Elm from './Main.elm'"},{"wrong":"import { Main } from './Main.elm'","symbol":"Elm.Main","correct":"import Elm from './Main.elm'; Elm.Main.init({node: document.getElementById('main')})"},{"note":"CommonJS require returns the default object.","wrong":"const { Elm } = require('./Main.elm')","symbol":"default (import)","correct":"const Elm = require('./Main.elm')"}],"quickstart":{"code":"// webpack.config.js\nconst path = require('path');\nmodule.exports = {\n  module: {\n    rules: [{\n      test: /\\.elm$/,\n      exclude: [/elm-stuff/, /node_modules/],\n      use: {\n        loader: 'elm-webpack-loader',\n        options: {\n          cwd: path.resolve(__dirname, 'src')\n        }\n      }\n    }]\n  },\n  resolve: {\n    extensions: ['.elm']\n  }\n};","lang":"javascript","description":"Minimal webpack configuration to process Elm files using elm-webpack-loader with the recommended cwd option."},"warnings":[{"fix":"Upgrade to Webpack 5.","message":"Version 8.0.0 drops Webpack 4 support. Webpack 5 is required.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Replace pathToElm with cwd option.","message":"The 'pathToElm' option is deprecated and will be removed. Use 'cwd' instead.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Set cwd to the directory containing elm.json.","message":"If you don't set the 'cwd' option, the loader may not find elm.json and will compile from the current working directory.","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Use object-style configuration for loader options.","message":"The 'files' option only works when using object-style loader configuration, not inline or CLI.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Build elm-make from source with -rtsopts flag.","message":"Using the 'runtimeOptions' requires a custom Elm binary built with -rtsopts enabled. Default Elm binary doesn't support it.","severity":"gotcha","affected_versions":">=6.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev elm' to install elm package.","cause":"Elm compiler not installed globally or in project dependencies.","error":"Error: 'elm' is not recognized as an internal or external command"},{"fix":"Add the elm-webpack-loader rule to webpack configuration.","cause":"Webpack not configured to process .elm files.","error":"Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type."},{"fix":"Install elm as a dev dependency: 'npm install --save-dev elm'.","cause":"Elm package is not installed as a dependency.","error":"Cannot find module 'elm'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}