By default, Vue-CLI-service serves on HTTP 1.1. Is there any way to serve it on HTTP-2?
1 Answer
Vue CLI's devServer configuration is passed to the underlying Webpack, so you could set devServer.http2=true to enable HTTP2. Note that devServer.https=true is also needed for Vue CLI to use HTTPS (required for HTTP2 to work):
// vue.config.js
module.exports = {
devServer: {
https: true,
http2: true,
}
}
Despite Webpack's deprecation warnings for both the options above, this configuration actually works for the current version of Webpack (version 5.65.0) used by Vue CLI 5.0.0-rc.1. Switching to devServer.server=spdy without enabling devServer.https does not work.