Registry / web-framework / babel-ui5-module-formatter

babel-ui5-module-formatter

JSON →
library0.0.1jsnpmunverified

A Babel plugin that transforms ES6 module syntax into sap.ui.define AMD-style calls for SAPUI5/OpenUI5 applications. Version 0.0.1 is an initial release with no recent updates. It fills the gap between modern JavaScript modules and UI5's legacy AMD module system, enabling developers to write ES6 code and compile it for UI5. Unlike standard Babel module transforms, this plugin targets SAP's specific define pattern.

npm install babel-ui5-module-formatter
INSTALL
IMPORT
SIG · BABEL-UI5-MODULE-F
B
babel-ui5-module-formatter
web-frameworkjavascriptv0.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
import formatter from 'babel-ui5-module-formatter';
const formatter = require('babel-ui5-module-formatter');
The package likely exposes a Babel plugin; using default import is recommended.
default
plugins: [['babel-ui5-module-formatter', { /* options */ }]]
plugins: ['babel-ui5-module-formatter']
In Babel config, use array syntax to pass options, not just the string.
default
module.exports = { plugins: [['babel-ui5-module-formatter', { /* options */ }]] };
module.exports = { plugins: ['babel-ui5-module-formatter'] };
CommonJS require for Babel config; options object should be passed as second element in array.

Shows installation, Babel config with plugin options, and a minimal ES6 module transformation to sap.ui.define.

// Install: npm install --save-dev babel-ui5-module-formatter // In .babelrc or babel.config.js: { "plugins": [ ["babel-ui5-module-formatter", { "moduleName": "my/module/name" }] ] } // Input ES6: import { helper } from './helper'; export default class MyClass {} // Output AMD: sap.ui.define(['./helper'], function(helper) { 'use strict'; return function() { // class definition }; });
Debug
Known issues
gotchaPlugin must be placed after @babel/plugin-transform-modules-commonjs or similar module transform to work correctly.
fix
Ensure other module transforms are not conflicting; this plugin replaces the standard module transform for UI5.
affects: >=0.0.1
deprecatedBabel 6 presets and plugins are deprecated; this plugin may not be compatible with Babel 7+.
fix
Check if the plugin supports Babel 7; consider using @ui5/builder or ui5-loader as alternatives.
affects: >=0.0.1
gotchaThe plugin does not handle dynamic imports (import()) correctly and may throw errors.
fix
Avoid dynamic imports in UI5 projects, or use a different module bundler like ui5-tooling.
affects: >=0.0.1
gotchaOptions like 'moduleName' are undocumented; the plugin may require specific module name format.
fix
Use with default options first; refer to example project for guidance.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Plugin babel-ui5-module-formatter: Unknown option 'moduleName'.
The option name is incorrect or the plugin version doesn't support it.
fix
Use correct option name as per documentation (currently undocumented; avoid options or check source code).
TypeError: Cannot read property 'replace' of undefined
The plugin expects specific AST node types that may not exist if other babel transforms run after it.
fix
Ensure babel-ui5-module-formatter is the last plugin in the plugins array.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

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