How to store a prefab in an AssetBundle dynamically by an Editor Script?

Assume the prefab creation works fine:

var prefab = PrefabUtility.CreatePrefab("Assets/Prefabs/myPrefab.prefab", myGameObject, ReplacePrefabOptions.Default);

Means “prefab” is not null.

But now I want to store/save the prefab in an AssetBundle. How is this archived?
My try:

 var buildMap = new List<AssetBundleBuild> {
            new AssetBundleBuild {
                    assetBundleName = "MyPrefab in an AssetBundle",
                    assetNames = new [] { AssetDatabase.GetAssetPath(prefab) }
            }
    };
    var manifest = BuildPipeline.BuildAssetBundles("Assets/AssetBundle/uweTest.unity3d",
                                            buildMap.ToArray(),
    BuildAssetBundleOptions.None,
    BuildTarget.StandaloneWindows);

Any help would be great!
Thanks in advance!

The code abaove works fine. It does NOT contain any error.
But:
The prefab was NOT build/created because the project contained “other errors” that prevent “the system” to reach the “player” mode.
After fixed these errors, the code worked as expected (and returned a non null value as manifest)

Strange unity editor behavior, because why was all other code running perfectly but not building the AssetBundle.

Hope this helps someone else.