This is normal. I guess you are placing your code in window.onload or something like that but it is never triggered in background script. You should place the code directly in background.js.
//background.js
console.log("Hello World !") //Code executed
window.onload = function(){
console.log("Hello World !") //Code never executed
};