Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing via composer issue #153

Open
1 task done
BBTJohn opened this issue Sep 21, 2023 · 4 comments
Open
1 task done

Installing via composer issue #153

BBTJohn opened this issue Sep 21, 2023 · 4 comments
Labels
help wanted Extra attention is needed type:bug Something isn't working.

Comments

@BBTJohn
Copy link

BBTJohn commented Sep 21, 2023

Describe the bug

When installing via composer through wpackagist.org, there im getting an error.

Notice: Function register_block_script_handle was called incorrectly. The asset file (/var/www/[PROJECTNAME]/web/app/plugins/safe-svg/includes/blocks/safe-svg/../../../dist/safe-svg-block.asset.php) for the "editorScript" defined in "safe-svg/svg-icon" block definition is missing. Please see [Debugging in WordPress](https://wordpress.org/documentation/article/debugging-in-wordpress/) for more information. (This message was added in version 5.5.0.) in /var/www/expedite/web/wp/wp-includes/functions.php on line 5905

Upon checking the file structure, it looks like the directory dist is missing. I also checked the gitignore file and it looks like the plugin is ignoring the dist directory.

Steps to Reproduce

install safe-svg via composer.
https://wpackagist.org/search?q=safe-svg&type=any&search=

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@BBTJohn BBTJohn added the type:bug Something isn't working. label Sep 21, 2023
@thaddeusm
Copy link

Having the same issue.

@jeffpaul jeffpaul added this to the Future Release milestone Jan 11, 2024
@jeffpaul jeffpaul added the help wanted Extra attention is needed label Jan 11, 2024
@JacobDB
Copy link

JacobDB commented Jan 26, 2024

Also experiencing this issue. Since this appears to be related to the block editor, I tried to just remove the block registration, but there doesn't seem to be a good way to do that because of the way it's hooked in...

add_action( 'init', array( $this, 'setup_blocks' ) );

Any chance we could just get a getInstance() function so that we can dequeue this if we don't need the block? Something like this would then allow us to dequeue it...

remove_action( 'init', array( SafeSvg\safe_svg::getInstance(), 'setup_blocks' ) );

@dkotter
Copy link
Collaborator

dkotter commented Apr 17, 2024

Curious on your setup for installing this via composer? I just tried a fairly basic composer.json (pasted below) and it did install things correctly, including the dist directory, when I ran composer install:

{
    "name": "10up/test",
    "description": "Test",
    "repositories":[
        {
            "type":"composer",
            "url":"https://wpackagist.org",
            "only": [
                "wpackagist-plugin/*"
            ]
        }
    ],
    "require": {
        "wpackagist-plugin/safe-svg":"2.2.4"
    },
    "config": {
        "allow-plugins": {
            "composer/installers": true
        }
    },
     "extra": {
        "installer-paths": {
            "plugins/{$name}/": [
                "type:wordpress-plugin"
            ]
        }
    }
}

@JacobDB
Copy link

JacobDB commented Apr 17, 2024

I honestly don't remember what I did, sorry. I just tried this again, and it seems to be working just fine, even when I require it directly (i.e. require "vendor/darylldoyle/safe-svg/safe-svg.php";). No idea what was causing the error before, but I'll report back if I find it again.

Quick side note – I'd love this as a library instead of a WordPress plugin; I develop bespoke WordPress themes for clients, and with our workflow, sometimes it's more preferential to require plugins like this within our theme rather than having them installed directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type:bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

5 participants