{"id":26790,"library":"babel-ui5-module-formatter","title":"babel-ui5-module-formatter","description":"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.","status":"active","version":"0.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","ui5","sapui5","openui5","babel","babeljs","es6"],"install":[{"cmd":"npm install babel-ui5-module-formatter","lang":"bash","label":"npm"},{"cmd":"yarn add babel-ui5-module-formatter","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-ui5-module-formatter","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package likely exposes a Babel plugin; using default import is recommended.","wrong":"const formatter = require('babel-ui5-module-formatter');","symbol":"default","correct":"import formatter from 'babel-ui5-module-formatter';"},{"note":"In Babel config, use array syntax to pass options, not just the string.","wrong":"plugins: ['babel-ui5-module-formatter']","symbol":"default","correct":"plugins: [['babel-ui5-module-formatter', { /* options */ }]]"},{"note":"CommonJS require for Babel config; options object should be passed as second element in array.","wrong":"module.exports = { plugins: ['babel-ui5-module-formatter'] };","symbol":"default","correct":"module.exports = { plugins: [['babel-ui5-module-formatter', { /* options */ }]] };"}],"quickstart":{"code":"// Install: npm install --save-dev babel-ui5-module-formatter\n// In .babelrc or babel.config.js:\n{\n  \"plugins\": [\n    [\"babel-ui5-module-formatter\", {\n      \"moduleName\": \"my/module/name\"\n    }]\n  ]\n}\n// Input ES6:\nimport { helper } from './helper';\nexport default class MyClass {}\n// Output AMD:\nsap.ui.define(['./helper'], function(helper) {\n  'use strict';\n  return function() {\n    // class definition\n  };\n});","lang":"typescript","description":"Shows installation, Babel config with plugin options, and a minimal ES6 module transformation to sap.ui.define."},"warnings":[{"fix":"Ensure other module transforms are not conflicting; this plugin replaces the standard module transform for UI5.","message":"Plugin must be placed after @babel/plugin-transform-modules-commonjs or similar module transform to work correctly.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Check if the plugin supports Babel 7; consider using @ui5/builder or ui5-loader as alternatives.","message":"Babel 6 presets and plugins are deprecated; this plugin may not be compatible with Babel 7+.","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Avoid dynamic imports in UI5 projects, or use a different module bundler like ui5-tooling.","message":"The plugin does not handle dynamic imports (import()) correctly and may throw errors.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use with default options first; refer to example project for guidance.","message":"Options like 'moduleName' are undocumented; the plugin may require specific module name format.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use correct option name as per documentation (currently undocumented; avoid options or check source code).","cause":"The option name is incorrect or the plugin version doesn't support it.","error":"Error: Plugin babel-ui5-module-formatter: Unknown option 'moduleName'."},{"fix":"Ensure babel-ui5-module-formatter is the last plugin in the plugins array.","cause":"The plugin expects specific AST node types that may not exist if other babel transforms run after it.","error":"TypeError: Cannot read property 'replace' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}