As stated in #8520, dynamically setting publicPath to use a cdn url doesn’t work for img tags and assets referenced in css.
While i can make assets referenced in css work using
extractCSS: true and setting publicPath to the absolute cdn path (i.e. without the cdn hostname and protocol), i’m unable to make img tags work referencing image assets.
- nuxt: nuxt-edge@^2.15.0-26848868.eae3acb7
- node: 14
Link to codesandbox:
As you can see there, the images referenced via img tag as well as css use the build-time publicPath,
Steps to reproduce
build.publicPath to equal
process.env.CDN_URL and add an
img tag to a component referencing e.g.
CDN_URL=/_nuxt/ yarn build and then
CDN_URL=https://cdn.host/path/to/assets/ yarn start
What is Expected?
img tag should be referenced via
What is actually happening?
img tag will still be referenced via