To enable Code components in power Apps – one need to Enable it First . the following are the steps .
Step 01 : Login to Power Platform admin portal
Step02 : Switch to your environment .
Step03 : Prodducts => Features => Enable Code Components .
Once you do the above , you should be able to import Code Components and use it in your app.