Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ulisses-alves/parcel-plugin-elm-bundle
Parcel plugin for bundling multiple Elm applications.
https://github.com/ulisses-alves/parcel-plugin-elm-bundle
Last synced: about 2 months ago
JSON representation
Parcel plugin for bundling multiple Elm applications.
- Host: GitHub
- URL: https://github.com/ulisses-alves/parcel-plugin-elm-bundle
- Owner: ulisses-alves
- License: mit
- Created: 2019-01-11T10:48:40.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T02:47:28.000Z (about 2 years ago)
- Last Synced: 2024-11-13T12:45:20.694Z (about 2 months ago)
- Language: HTML
- Size: 2.12 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# parcel-plugin-elm-bundle
Parcel plugin for bundling multiple Elm applications.## Use-case
Let's say you have two Elm application modules, `A` and `B`; and both will be imported and initialized in a parent application:`./index.js`
```javascript
import { Elm as ElmA } from './elm/A.elm'
import { Elm as ElmB } from './elm/B.elm'ElmA.A.init(...)
ElmB.B.init(...)
```Using Parcel's native Elm bundler, results into `A` and `B` being compiled indepently, so all modules shared between them will get bundled twice, thus producing a much larger output in comparison to:
```
elm make ./elm/A.elm ./elm/B.elm --output=bundle.js
```
This plugin provides a way combine the outputs of `A` and `B` by defining a module bundle file (.elmb):
`./apps.elmb`
```json
{
"modules": [
"./elm/A.elm",
"./elm/B.elm"
]
}
```
Now instead of importing the modules directly, the bundle definition file can be imported instead:
```javascript
import { A, B } from './apps.elmb'A.init(...)
B.init(...)
```
## Future
The expectation is that Parcel will eventually provide a built-in way to achieve the same results as this plugin, thus making it obsolete. In the mean time, pull requests, bug reports and suggestions are very much welcomed.