Registry / devops / parcel-resolver-elm-bundle

parcel-resolver-elm-bundle

JSON →
library1.0.2jsnpmunverified

parcel-resolver-elm-bundle is a Parcel resolver designed to streamline the compilation and bundling of multiple Elm source files into a single JavaScript output. It simplifies the process that would otherwise require manually listing all Elm entry points for `elm make`. The package is currently at version 1.0.2, indicating a stable, actively maintained release. While release cadence isn't explicitly stated, its integration with Parcel's resolver system suggests updates would align with major Parcel releases or significant Elm compiler changes. Its key differentiator is the custom `elm-bundle:` import syntax, allowing developers to define Elm bundles within their `package.json` and reference them abstractly, enhancing modularity and build system clarity for Elm projects within Parcel. This approach mimics the `elm make MainA.elm MainB.elm` command but integrates it directly into the JavaScript import graph, providing a seamless development experience for larger Elm applications.

npm install parcel-resolver-elm-bundle
INSTALL
IMPORT
SIG · PARCEL-RESOLVER-EL
P
parcel-resolver-elm-bundle
devopsjavascriptv1.0.2
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

Elm
import { Elm } from 'elm-bundle:widget-a';
const { Elm } = require('elm-bundle:widget-a');
This is a custom Parcel resolver import syntax. 'elm-bundle:widget-a' refers to a bundle defined in your `package.json`, not a direct file path. Parcel 2+ primarily uses ESM.
Elm_Type
import type { Elm } from 'elm-bundle:widget-a';
When using TypeScript, if you need to reference the type of the Elm application object, use a type-only import.

This quickstart demonstrates how to configure Parcel to use the `elm-bundle` resolver via `.parcelrc`, define an Elm bundle named 'widget-a' in `package.json`, and then import the compiled bundle into a JavaScript entry point for initialization.

{ "extends": "@parcel/config-default", "resolvers": ["parcel-resolver-elm-bundle", "..."] } // package.json { "name": "my-elm-app", "version": "1.0.0", "description": "My Elm application bundled with Parcel", "main": "index.js", "source": "index.html", "scripts": { "start": "parcel", "build": "parcel build" }, "elm-bundle": { "widget-a": [ "./src/Main.elm", "./src/MainB.elm", "./src/MainC.elm" ] }, "devDependencies": { "parcel": "^2.6.2", "parcel-resolver-elm-bundle": "^1.0.0" }, "peerDependencies": { "elm": "^0.19.1-5" } } // src/index.js import { Elm } from 'elm-bundle:widget-a'; const app = Elm.Main.init({ node: document.getElementById('elm-app') }); // Example: Interact with Elm ports (if defined in Main.elm) // app.ports.fromElm.subscribe(message => { // console.log('Received from Elm:', message); // }); // app.ports.toElm.send('Hello from JavaScript!');
Debug
Known issues
gotchaIncorrect resolver order in `.parcelrc` can prevent `parcel-resolver-elm-bundle` from being invoked, leading to 'Module not found' errors or incorrect Elm compilation.
fix
Ensure `parcel-resolver-elm-bundle` is listed before other generic resolvers (like `...`) in your `.parcelrc` resolvers array: `"resolvers": ["parcel-resolver-elm-bundle", "..."]`.
affects: >=1.0.0
gotchaUsing an older Parcel version than specified in `engines` may cause compatibility issues or build failures, as Parcel's internal resolver APIs can change significantly between major versions.
fix
Upgrade Parcel to `^2.6.2` or higher to ensure compatibility with the resolver. Run `npm install parcel@latest` or `yarn add parcel@latest`.
affects: <2.6.2
gotchaThe resolver depends on the `elm` compiler being available. If `elm` is not installed or discoverable in the system's PATH, compilation will fail.
fix
Install Elm globally via `npm install -g elm` or as a dev dependency `npm install --save-dev elm`, ensuring it's accessible to your build environment.
affects: >=1.0.0
Errors
Common errors & fixes
Module not found: Can't resolve 'elm-bundle:widget-a'
The Parcel resolver for `elm-bundle` is not correctly configured or active, or the bundle name (`widget-a`) is misspelled or not defined in `package.json`.
fix
Verify `parcel-resolver-elm-bundle` is in your `.parcelrc` before `...`, and ensure the `elm-bundle` section in `package.json` correctly defines `widget-a` with valid paths to Elm entry files.
Error: Could not find Elm executable. Please install Elm: elm install
The `elm` peer dependency is missing or not correctly installed/accessible in the project environment.
fix
Install Elm globally or locally: `npm install -g elm` or `npm install --save-dev elm` (if using `npx elm`). Ensure it's available in your system's PATH or `node_modules/.bin`.
Error: Failed to resolve entry point "./src/Main.elm" (or similar path error)
A file path specified in the `elm-bundle` array in `package.json` is incorrect, or the file does not exist at the specified relative path.
fix
Double-check all file paths within your `package.json` `elm-bundle` definitions. Paths must be relative to the `package.json` file itself.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
parcelrequiredThis package is a Parcel resolver and requires Parcel to function.
elmrequiredThe resolver compiles Elm source code and requires the Elm compiler.
Agent activity
2 hits · last 30 days
node
2
Resources
parcel-resolver-elm-bundle — npm install parcel-resolver-elm-bundle · libregistry