@sergiz You are making it unnecessarily complicated. Layout.js is needed in every view, so add it to your layout view.
pagea.js,pageb.js,pagec.js will be added in dedicated page views.
Now the only question remains is for a common.js. You have two option, either add it in the layout file or manually add it to only pagea.js and pageb.js only.
If you are using build toold for example webpack, then, merge common.js to pagea.js or pageb.js OR import functionalities in those scripts from common.js (if its a module).