public function resolve($resource)
    {
        foreach ($this->loaders() as $loader) {
            if ($loader->supports($resource)) {
                return $loader;
            }
        }

        throw new LoaderException('No matching loader found.');
    }