Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[AssetMapper] Allow to import assets from url or using other resolvers #53999

Open
@adeys

Description

@adeys

Description

I'm trying to require the @editorjs/editorjs package but unfortunately the jsdeliver powered endpoint seems to be broken
This is what I get in the downloaded file :

/**
 * Failed to bundle using Rollup v2.79.1.
 * If you believe this to be an issue with jsDelivr, and not with the package itself, please open an issue at https://github.com/jsdelivr/jsdelivr
 */

 throw new Error('Failed to bundle using Rollup v2.79.1. If you believe this to be an issue with jsDelivr, and not with the package itself, please open an issue at https://github.com/jsdelivr/jsdelivr');

It seems to be an error from jsDeliver as the package.json file from EditorJS hasn't been changed lately and the esm import works when using :
import Editor from 'https://esm.sh/@editorjs/[email protected]';

Adding an url option may be an easy fix at first, so that user can require any file from anywhere
Adding either another resolver to the import map package resolver (jspm.io, unpkg.com, esm.sh) could help to get around those error cases would also help to not get constrained by errors from CDN

Example

A) importmap:require url option

bin/console importmap:require @editorjs/editorjs --url=https://esm.sh/v135/@editorjs/[email protected]/es2022/editorjs.mjs

B) importmap:require resolver option

bin/console importmap:require @editorjs/editorjs --resolver=<resolver>

The resolver option could be any class implementing Symfony\Component\AssetMapper\ImportMap\Resolver\PackageResolverInterface and may be assigned an alias so that it can be used in the importmap:require command

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions