Yes, SPFx package will install required scripts which will run on both the classic and modern pages.