{"id":41649,"library":"oc-template-elm-compiler","title":"OC Template Elm Compiler","description":"A compiler package for the Elm OpenComponents template, enabling Elm components within the OpenComponents ecosystem. Version 3.0.0 is the current stable release, with low release cadence. It provides integration via predefined Elm ports (getData, dataReceiver) and supports custom ports through a JavaScript entry file. Differentiators: official OC template for Elm, ESM-only, ships TypeScript types. Note: Marked as work-in-progress/not ready for production.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/opencomponents/vite-templates","tags":["javascript","oc","opencomponents","elm","oc-template","typescript"],"install":[{"cmd":"npm install oc-template-elm-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add oc-template-elm-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add oc-template-elm-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to type-check Elm template integration","package":"oc-template-elm","optional":true}],"imports":[{"note":"ESM-only; named export 'compile' is the correct import.","wrong":"import ocTemplateElmCompiler from 'oc-template-elm-compiler'","symbol":"default (compiler)","correct":"import { compile } from 'oc-template-elm-compiler'"},{"note":"Package is ESM-only; CommonJS require will fail in Node < 13 or without .mjs extension.","wrong":"const { compile } = require('oc-template-elm-compiler')","symbol":"compile","correct":"import { compile } from 'oc-template-elm-compiler'"},{"note":"Elm is a named export from .elm files when using the Elm compiler.","wrong":"import Elm from './Main.elm'","symbol":"Elm","correct":"import { Elm } from './Main.elm'"}],"quickstart":{"code":"import { compile } from 'oc-template-elm-compiler';\nconst options = {\n  viewWrapper: {\n    css: true,\n    html: true\n  }\n};\nconst compiled = await compile('path/to/component.elm', options);\nconsole.log(compiled);","lang":"typescript","description":"Demonstrates importing the compile function and using it to compile an Elm component with options."},"warnings":[{"fix":"Check the latest documentation for updated options object shape.","message":"The 'compile' function options may change in future releases.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Use import syntax or set { type: 'module' } in your package.json.","message":"Package is ESM-only; require() will not work.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Switch from require() to import statements.","message":"Removed support for CommonJS in v3.0.0.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Define ports as shown in README: port getData : E.Value -> Cmd msg etc.","message":"The Elm template requires specific port definitions (getData, dataReceiver) in your Elm code.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure you have oc-template-elm installed if you use this compiler.","message":"The 'oc-template-elm' package is a dependency but may be removed in future versions.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'/not':68 '3.0.0':21 'cadenc':30 'compil':4,6 'compon':15 'current':24 'custom':42 'datareceiv':39 'differenti':49 'ecosystem':19 'elm':3,10,14,36,54,75 'enabl':13 'entri':47 'esm':56 'esm-on':55 'file':48 'getdata':38 'integr':33 'javascript':46,72 'low':28 'mark':62 'note':61 'oc':1,51,73,77 'oc-templ':76 'offici':50 'opencompon':11,18,74 'packag':7 'port':37,43 'predefin':35 'product':71 'progress':67 'provid':32 'readi':69 'releas':26,29 'ship':58 'stabl':25 'support':41 'templat':2,12,52,78 'type':60 'typescript':59,79 'version':20 'via':34 'within':16 'work':65 'work-in-progress':64","created_at":"2026-06-04T18:53:26.003217+00:00","updated_at":"2026-06-04T18:53:26.003217+00:00","problems":[{"fix":"npm install oc-template-elm","cause":"Missing required peer dependency oc-template-elm","error":"Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'oc-template-elm'"},{"fix":"Add \"type\": \"module\" to package.json or use .mjs file extension","cause":"Trying to use import in a CommonJS context","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Use import { compile } from 'oc-template-elm-compiler'","cause":"Incorrect default import instead of named import","error":"TypeError: compile is not a function"},{"fix":"Add port getData : E.Value -> Cmd msg and port dataReceiver : (E.Value -> msg) -> Sub msg in Elm","cause":"Elm component missing required port definitions","error":"Error: Port 'getData' not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/opencomponents/vite-templates#readme","github":"https://github.com/opencomponents/vite-templates","docs":null,"changelog":null,"pypi":null,"npm":"oc-template-elm-compiler","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}