This gist demonstrates one of the issues with the new build system of Frappe.
Step 1
Add the sq.js
and square.bundle.js
from gist to apps/frappe/frappe/public/js
in your bench.
Step 2
Run build.
$ bench build --app=frappe
Step 3
Look at the contents of dist/js/square.bundle.*.js
.
$ cat apps/frappe/frappe/public/dist/js/square.bundle.*.js
(() => {
})();
//# sourceMappingURL=square.bundle.BGCA7SNG.js.map
This is tree shaking in action. You are not exporting the function nor you are assigning it some global variable, so it wont be available in the final bundle.
Try these changes:
As far as I remember, you would get the same behaviour with the previous rollup based build.