(+add cors settings on serving end)
so now the cache on CDN will not be separated and all new users will hit one cache when they load JS/CSS/fonts.
If I use native top-level publicPath option, some Vue runtime code creates a redirect and breaks a route by adding domain there, but I don't want redirect, I really want index.html to be served from https://sub2.mydomain.com/, I only need to change URLs of assets, not route of the application.
I had to destroy validateWebpackConfig.js in my CI build pipeline to solve this issue quickly, and after this, applications works perfectly:
ADD package-lock.json .
ADD package.json .
RUN npm ci
# ugly fix to prevent Avoid modifying webpack output.publicPath directly.
RUN echo "module.exports = function validateWebpackConfig () {}" > 'node_modules/@vue/cli-service/lib/util/validateWebpackConfig.js'
But it would be better if we can disable this "smart mode" and allow some flexibility, at least if we would have an option like allowOutputPublicPath :
if (!singleConfig.allowOutputPublicPath && target === 'app' && singleConfig.output.publicPath !== options.publicPath) {
only then drop exception
Is there any better ways to point all statics to be loaded from different domain? This definitely not super popular case, but from time to time developers might need it.
What is actually happening?
Configuration Error: Avoid modifying webpack output.publicPath directly. Use the "publicPath" option instead
Version
@vue/cli-service 3.5.0
Environment info
Steps to reproduce
Define output.publicPath in vue.config.js
What is expected?
I need a way to pass output.publicPath without this exception message. My usecase:
I serve same Vue SPA on hundreds-thouthands subdomains:
https://sub1.mydomain.com/ https://sub2.mydomain.com/ https://sub3.mydomain.com/ https://sub4.mydomain.com/
etc. Like workpsaces in Slack.
Every time when new user joins service and creates new workpace on new subdomain, it does not hit a cache on CDN because URL is always different https://sub123.mydomain.com/js/app.js, https://sub124.mydomain.com/js/app.js.
So CDN bypasses the request to slower upstream and takes redundant place in caches store by storing same files on different urls.
To solve this, only one simple thing which I need to do is:
(+add cors settings on serving end) so now the cache on CDN will not be separated and all new users will hit one cache when they load JS/CSS/fonts.
If I use native top-level publicPath option, some Vue runtime code creates a redirect and breaks a route by adding domain there, but I don't want redirect, I really want index.html to be served from https://sub2.mydomain.com/, I only need to change URLs of assets, not route of the application.
I had to destroy validateWebpackConfig.js in my CI build pipeline to solve this issue quickly, and after this, applications works perfectly:
But it would be better if we can disable this "smart mode" and allow some flexibility, at least if we would have an option like allowOutputPublicPath :
Is there any better ways to point all statics to be loaded from different domain? This definitely not super popular case, but from time to time developers might need it.
What is actually happening?
Configuration Error: Avoid modifying webpack output.publicPath directly. Use the "publicPath" option instead