-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Vite+Vue+Vuetify problem with dev URL #7080
-
Hello, please tell me how to solve the problem.
I have a project Vite+Vue+Vuetify.
When I run npm run den
follow the link http://localhost:8080/ (in browser this - https://mydomain/proxy/8080/).
I'm getting an error:
GET https://mydomain/src/main.js net::ERR_ABORTED 404 (Not Found)
and
GET https://mydomain/@vite/client net::ERR_ABORTED 404 (Not Found)
The problem is URL paht. How to change the path:
GET https://mydomain/src/main.js
to GET https://mydomain/proxy/8080/src/main.js
and
GET https://mydomain/@vite/client net
to GET https://mydomain/proxy/8080/@vite/client net
by default, that is, force vite to replace https://mydomain/
to https://mydomain/proxy/8080/
?
This my vite.config:
// Plugins
import Components from 'unplugin-vue-components/vite'
import Vue from '@vitejs/plugin-vue'
import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
import ViteFonts from 'unplugin-fonts/vite'
import VueRouter from 'unplugin-vue-router/vite'
// Utilities
import { defineConfig } from 'vite'
import { fileURLToPath, URL } from 'node:url'
export default defineConfig({
plugins: [
VueRouter(),
Vue({
template: { transformAssetUrls }
}),
Vuetify({
autoImport: true,
styles: {
configFile: 'src/styles/settings.scss',
},
}),
Components(),
ViteFonts({
google: {
families: [{
name: 'Roboto',
styles: 'wght@100;300;400;500;700;900',
}],
},
}),
],
define: { 'process.env': {} },
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
extensions: [
'.js',
'.json',
'.jsx',
'.mjs',
'.ts',
'.tsx',
'.vue',
],
},
server: {
port: 8080,
},
})
p.s. I tried different settings with resolve alias and proxy, but...
Beta Was this translation helpful? Give feedback.
All reactions
Does this help? #6888 (comment)
tl;dr is to add base: "/absproxy/3454",
and use /absproxy
to visit instead of /proxy
Replies: 1 comment 1 reply
-
Does this help? #6888 (comment)
tl;dr is to add base: "/absproxy/3454",
and use /absproxy
to visit instead of /proxy
Beta Was this translation helpful? Give feedback.
All reactions
-
Does this help? #6888 (comment)
tl;dr is to add
base: "/absproxy/3454",
and use/absproxy
to visit instead of/proxy
thanks, it worked
Beta Was this translation helpful? Give feedback.