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

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

Open
piotrkulpinski opened this issue Apr 4, 2022 · 0 comments

Comments

@piotrkulpinski
Copy link

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`;
    },
  },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant