generator-chisel icon indicating copy to clipboard operation
generator-chisel copied to clipboard

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

Open piotrkulpinski opened this issue 3 years ago • 0 comments

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`;
    },
  },
}

piotrkulpinski avatar Apr 04 '22 12:04 piotrkulpinski