55 * Uses the custom rollup-plugin-ui5-webcomponents.js with metadata extraction
66 */
77
8- import { rollup } from "rollup" ;
9- import { nodeResolve } from "@rollup/plugin-node-resolve" ;
10- import commonjs from "@rollup/plugin-commonjs" ;
118import { mkdir , writeFile } from "fs/promises" ;
129import path from "path" ;
1310import { fileURLToPath } from "url" ;
14- import { printScenarioHeader } from "./shared-config.js" ;
11+ import {
12+ createRollupConfig ,
13+ generateAMDBundleWithOutput ,
14+ printScenarioHeader
15+ } from "./shared-config.js" ;
1516import ui5WebComponentsPlugin from "../lib/plugins/rollup-plugin-ui5-webcomponents.js" ;
1617import { DEFAULT_CONFIG , createPluginOptions } from "../lib/config/standalone-config.js" ;
1718import { ThirdpartyGenerator } from "../lib/utils/thirdparty-generator.js" ;
@@ -27,23 +28,18 @@ async function bundleWebComponents() {
2728 const $metadata = { } ;
2829
2930 try {
30- // Use shared configuration (DRY principle)
31+ // Create plugin with metadata collection
3132 const plugin = ui5WebComponentsPlugin ( createPluginOptions ( console , $metadata ) ) ;
3233
33- const bundle = await rollup ( {
34- input : "@ui5/webcomponents/dist/MessageStrip.js" ,
35- plugins : [
36- nodeResolve ( { browser : true , preferBuiltins : false } ) ,
37- commonjs ( ) ,
38- plugin
39- ] ,
40- external : [ / ^ s a p \/ / ]
41- } ) ;
42-
43- const { output} = await bundle . generate ( {
44- format : "amd" ,
45- amd : { define : "sap.ui.define" }
46- } ) ;
34+ // Use shared configuration (DRY principle)
35+ const config = createRollupConfig (
36+ "@ui5/webcomponents/dist/MessageStrip.js" ,
37+ [ plugin ] ,
38+ { external : [ / ^ s a p \/ / ] }
39+ ) ;
40+
41+ // Generate bundle with full output (needed for chunks)
42+ const output = await generateAMDBundleWithOutput ( config ) ;
4743
4844 console . log ( "\n✅ Bundle generated successfully!\n" ) ;
4945
0 commit comments