Yarn build:production errors - svgo

Getting some errors when running yarn run build:production related to svgo.

Any advice?

The error is telling you that the following file:


is missing but it’s referenced in your scss.

Double check that!

Thanks for the reply.

Here’s my main.scss

Nothing out of the ordinary, just a couple extra includes and some third party includes per the documentation.

I have tried removing all includes from the main.scss and the error remains the same.

I’ve also tried removing all svg files from my theme, but I also receive the same error.

I should not that yarn run build works as intended.

What webpack is telling you is that, when running the production (which means when disabling the sourcemaps), it’s unable to locate that file (which might come from a third party lib or from your own code).

This means that somewhere in your code you’re referring to that file with a wrong variable. That variable should include the full path to the file.

Not sure if it makes sense but hope so! :slight_smile:

Thanks @Nicolo_Sacchi. I understand the gist of the error. I just can’t figure out where in my customization this reference would have occurred.

In short, I’ve only altered template files, added some of my own custom (really basic) functions, and edited/added SCSS files to be imported into main.scss. (reverting the main.scss back to the dev branch didn’t fix)

I’m just confused as to where I could have created this error.

In my experience this happens when you don’t redefine some variables from the libs you’re using.
To make an example, for font awesome I always redefine the following:

$fa-font-path: "~font-awesome/fonts";

There might be something similar for you in one of the libs you’re using!

@Nicolo_Sacchi That definitely makes sense. However, it doesn’t seem to be the case in my situation. I receive the same errors as mentioned before, even after trying each of these steps:

  1. Confirm that variables from external libraries are redefined as you suggested - same errors
  2. Remove all third-party dependencies - same errors
  3. Completely reverting to origin via
    git fetch origin git reset --hard origin/master - same errors

I should also include however, that if I fresh install the theme via composer, the build:production tasks works.

Ah! Found it. I had previously run yarn clean as opposed to yarn run clean. This created some issues.

Removing .yarnclean and node_modules, and re-running yarn fixed the aforementioned error

Thanks @Nicolo_Sacchi for your assistance!