Skip to content

Commit

Permalink
[FIX] Bundler: Create sap-ui-core-dbg.js (#176)
Browse files Browse the repository at this point in the history
Fixes: #175
  • Loading branch information
matz3 authored Feb 28, 2019
1 parent 9a790a3 commit feb95e4
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 41 deletions.
107 changes: 67 additions & 40 deletions lib/tasks/bundlers/generateLibraryPreload.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,47 +108,74 @@ module.exports = function({workspace, dependencies, options}) {
filters = ["jquery.sap.global.js"];
}

p = moduleBundler({
options: {
bundleOptions: {
optimize: true,
decorateBootstrapModule: true,
addTryCatchRestartWrapper: true,
usePredefineCalls: true
p = Promise.all([
moduleBundler({
options: {
bundleOptions: {
optimize: true,
decorateBootstrapModule: true,
addTryCatchRestartWrapper: true,
usePredefineCalls: true
},
bundleDefinition: {
name: "sap-ui-core.js",
sections: [
{
// include all 'raw' modules that are needed for the UI5 loader
mode: "raw",
filters,
resolve: true, // dependencies for raw modules are taken from shims in .library files
sort: true, // topological sort on raw modules is mandatory
declareModules: false
},
{
mode: "preload",
filters: [
"sap/ui/core/Core.js"
],
resolve: true
},
{
mode: "require",
filters: [
"sap/ui/core/Core.js"
]
}
]
}
},
bundleDefinition: {
name: "sap-ui-core.js",
sections: [
{
// include all 'raw' modules that are needed for the UI5 loader
mode: "raw",
filters,
resolve: true, // dependencies for raw modules are taken from shims in .library files
sort: true, // topological sort on raw modules is mandatory
declareModules: false
},
{
mode: "preload",
filters: [
"sap/ui/core/Core.js"
],
resolve: true
},
{
mode: "require",
filters: [
"sap/ui/core/Core.js"
]
}
]
}
},
resources
}).then(([bundle]) => {
if (bundle) {
// console.log("sap-ui-core.js bundle created");
return workspace.write(bundle);
}
resources
}),
moduleBundler({
options: {
bundleOptions: {
optimize: false
},
bundleDefinition: {
name: "sap-ui-core-dbg.js",
sections: [
{
// include all 'raw' modules that are needed for the UI5 loader
mode: "raw",
filters,
resolve: true, // dependencies for raw modules are taken from shims in .library files
sort: true, // topological sort on raw modules is mandatory
declareModules: false
},
{
mode: "require",
filters: [
"sap/ui/core/Core.js"
]
}
]
}
},
resources
})
]).then((results) => {
const bundles = Array.prototype.concat.apply([], results);
return Promise.all(bundles.map((bundle) => workspace.write(bundle)));
});
} else {
p = Promise.resolve();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sap.ui.requireSync("sap/ui/core/Core");
// as this module contains the Core, we ensure that the Core has been booted
sap.ui.getCore().boot && sap.ui.getCore().boot();
2 changes: 1 addition & 1 deletion test/lib/tasks/bundlers/generateLibraryPreload.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ test("integration: build sap.ui.core with library preload", async (t) => {
assert.directoryDeepEqual(destPath, expectedPath);

// Check for all file contents
t.deepEqual(expectedFiles.length, 6, "6 files are expected");
t.deepEqual(expectedFiles.length, 7, "7 files are expected");
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
Expand Down

0 comments on commit feb95e4

Please sign in to comment.