ui5-community / babel-plugin-transform-modules-ui5

A Babel transformer plugin for OpenUI5/SAPUI5. It allows you to develop UI5 applications by using the latest ECMAScript or TypeScript, including new syntax and objective oriented programming technology.
MIT License
34 stars 16 forks source link

fix: support index modules for dependencies #123

Closed petermuessig closed 6 months ago

petermuessig commented 7 months ago

CommonJS or ES modules require index modules when a folder is required, e.g.:

import * from "./schema"

will in case of ./schema is a directory lookup the index module and require the following:

import * from "./schema/index"

under the hood. As the UI5 module loader cannot support this feature this Babel plugin checks for the existence of the index module and rewrites the import to the index module so that the UI5 loader also loads the proper module.