I guess every Magento 2 developer will run into this common problem at some point. You want to replace a static content file from the core,  you copy it into your theme directory and make your changes, and in the end nothing happens, because Magento still serves the static file from the core. The first thing you can do in your development environment is to delete the deployed static content file.  If Magento 2 is in developer mode, you can just make a new request to the frontend and the file will be automatically redeployed. If it is still not working, this can become a serious problem. In the next steps I want to explain how to debug the static file resolution to track down the issue.

Debug static file resolution

First thing is to find the URL for the file you want to access, e.g:


If you have not overwritten the file in your theme, this request will load the price-box.js file from the magento core module magento-catalog. As example, we assume you want to change this file. The correct way would be to place the new file in the folder:


This directory structure naming convention can easily lead to missspellings, or if you are not confident with the conventions you may miss some directory in the path.

To debug such typos or missing folder, there is a pretty easy way. First make sure you are running in developer mode, clean your caches, and remove the already deployed static content file from your filesystem, in our example this would be


Next, set a breakpoint in


on line 123.

protected function resolveFile(RuleInterface $fallbackRule, $file, array $params = [])
    foreach ($fallbackRule->getPatternDirs($params) as $dir) {
        $path = "{$dir}/{$file}";
        $dirRead = $this->readFactory->create($dir);
        if ($dirRead->isExist($file) && $this->checkFilePathAccess($file, $path)) {
            return $path;
    return false;

Now just request the static content file directly from your browser. In our example:


After hitting your breakpoint you can either go step by step through the loop, or just evaluate $fallbackRule->getPatternDirs($params) to see all paths in the right order where Magento is looking for your file. Now you should see if you have missplaced your file, if you have a typo or anthing like that.

Magento 2 static file resolution debug