Skip to content

devMiddlewareOptions hook should use options.output.base as a publicPath #522

Description

@piotrkulpinski

Hi,

I was just trying to move up the src into the theme folder. Not directly, but placed inside a subdirectory named static along with the dist folder.

While everything else went smoothly, I ran into an issue where my local server was not loading the generated static files.
After some research I found out, that it's trying to load them from a hardcoded path declared here.

I think it would be a good idea to change that so that it uses the config value set in options.output.base.

As a workaround, I hooked into it directly and changed the publicPath:

hooks: {
  wordPress: {
    devMiddlewareOptions(options) {
      options.publicPath = `/wp-content/themes/${wp.themeName}/static/dist`;
    },
  },
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions