Description
After Change publicPath is implemented, the only way to change the publicPath
would be in the npx frontity build
process. It’d be great if we also allow people to change it dynamically, at runtime.
Requirements
- Let users change the public path dynamically using a Frontity Query Options like
?frontity_public_path=/custom
. - Let users change the public path dynamically using their
frontity.settings.js
. - Let packages change the public path dynamically with their own logic using
beforeSSR
orafterSSR
functions. - Fallback to the public path defined during the build with
--public-path=/custom
. - Fallback to the default
/static
folder.
Other considerations:
- If we are going to populate
state.frontity.options.publicPath
, it would be great if it always contains the value of the public path, even if this was not populated via the state (frontity.settings.js
orafterSSR
) or a Frontity Query Option.
Possible solution
Resources
- Implementation in the old framework: https://github.com/wp-pwa/wp-pwa/blob/dev-stable/core/client/public-path.js
- Webpack docs: https://webpack.js.org/guides/public-path/
- Excalidraw: https://excalidraw.com/#json=5743121476354048,uUq66FnH1F5IMS0704mDug
- Frontity Query Options: Auth header in Source packages and Frontity Query Options