Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Vite+Vue+Vuetify problem with dev URL #7080

Answered by code-asher
dimagenius asked this question in Q&A
Discussion options

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...

You must be logged in to vote

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

Comment options

Does this help? #6888 (comment)

tl;dr is to add base: "/absproxy/3454", and use /absproxy to visit instead of /proxy

You must be logged in to vote
1 reply
Comment options

Does this help? #6888 (comment)

tl;dr is to add base: "/absproxy/3454", and use /absproxy to visit instead of /proxy

thanks, it worked

Answer selected by dimagenius
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /