Registry / serialization / babel-openui5-module-formatter

babel-openui5-module-formatter

JSON →
library0.0.1jsnpmunverified

A Babel plugin that transpiles ES6 module syntax into sap.ui.define calls (AMD-like syntax) for UI5 applications (OpenUI5/SAPUI5). Version 0.0.1 is the initial release; the project is in early development with low release cadence. It enables developers to write ES6 modules and compile them to the format expected by UI5's module loader. Key differentiators: it is a dedicated Babel formatter for UI5, but has several limitations: no support for named imports (use wildcard imports instead), relative imports only within the same or subdirectories, and cannot mix default and named exports. Alternatives include using a UI5-aware bundler or manually transpiling.

npm install babel-openui5-module-formatter
INSTALL
IMPORT
SIG · BABEL-OPENUI5-MODU
B
babel-openui5-module-formatter
serializationjavascriptv0.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default export
import myModule from 'babel-ui5-module-formatter'
const myModule = require('babel-ui5-module-formatter')
ESM-only package; requires Babel configured to use this plugin.

How to configure Babel with this plugin and a minimal ES6 module transpilation example.

// .babelrc configuration { "modules": "babel-ui5-module-formatter", "moduleIds": true } // Install npm install --save-dev babel-ui5-module-formatter // Example ES6 input (mymodule.js) export default class MyClass { constructor() { this.name = 'UI5'; } } // After transpilation, the output will be wrapped in sap.ui.define: // sap.ui.define(['module'], function(module) { // 'use strict'; // var MyClass = function MyClass() { // this.name = 'UI5'; // }; // return MyClass; // });
Debug
Known issues
breakingRelative imports to parent directories (e.g., '../foo') will fail at runtime.
fix
Use absolute imports like 'mycompany/myapp/foo' or ensure the Babel plugin resolves paths at transpile time.
affects: 0.0.1
breakingNamed imports (e.g., import { foo } from './mod') are not supported; use wildcard import (import * as mod from './mod').
fix
Replace named imports with 'import * as module from ...' and access exports via module.foo.
affects: 0.0.1
breakingMixing default and named exports in the same module will produce unexpected behavior in transpiled code.
fix
Use either a default export or named exports, not both.
affects: 0.0.1
breakingThe formatter only supports per-file default or named exports, but not both simultaneously.
fix
Restructure module to have either a single default export or multiple named exports (no mixing).
affects: 0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'babel-ui5-module-formatter'
Missing npm install or incorrect Babel configuration for the module formatter.
fix
Run 'npm install --save-dev babel-ui5-module-formatter' and ensure .babelrc has '"modules": "babel-ui5-module-formatter"'.
Error: Module 'babel-ui5-module-formatter' is not available
Outdated Babel version or wrong usage (e.g., using as a plugin instead of module formatter).
fix
Use the 'modules' option in .babelrc, not 'plugins'. Ensure Babel version 6.x is used.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
babel-openui5-module-formatter — npm install babel-openui5-module-formatter · libregistry