Throw exception if mixing imports in legacy mode