question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

404 after configuring alias

See original GitHub issue

Describe the bug

Reproduction

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

 npmPackages:
    @vitejs/plugin-vue: ^1.2.1 => 1.2.1 
    @vue/compiler-sfc: ^3.0.5 => 3.0.11 
    typescript: ^4.1.3 => 4.2.4 
    vite: ^2.1.5 => 2.2.1 
    vite-plugin-rewrite-all: ^0.1.2 => 0.1.2 
    vue: ^3.0.5 => 3.0.11 
    vue-router: ^4.0.6 => 4.0.6 
    vue-tsc: ^0.0.24 => 0.0.24 

Used package manager: npm

cofig.js

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'
import pluginRewriteAll from 'vite-plugin-rewrite-all';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),],
  // resolve: {
  //   alias: {
  //     '/lib/': resolve(__dirname,'lib'),
  //     '/module/': resolve(__dirname,'scr/module'),
  //   }
  // },
  assetsInclude:resolve(__dirname,'lib')
})

Logs

  vite:spa-fallback Not rewriting GET /libtiles/16/12320/2565.png because the path includes a dot (.) character. +17ms
  vite:time 5ms   /index.html +19ms
  vite:spa-fallback Not rewriting GET /libtiles/16/12320/2567.png because the path includes a dot (.) character. +11ms
  vite:time 3ms   /index.html +10ms
  vite:spa-fallback Not rewriting GET /libtiles/16/12322/2566.png because the path includes a dot (.) character. +5ms
  vite:time 2ms   /index.html +4ms
  vite:spa-fallback Not rewriting GET /libtiles/16/12319/2565.png because the path includes a dot (.) character. +4ms

remove alias config

  vite:time 3ms   /lib/tiles/16/12326/2565.png +1ms
  vite:time 2ms   /lib/tiles/16/12323/2569.png +872ms
  vite:time 1ms   /lib/tiles/16/12322/2569.png +0ms
  vite:time 2ms   /lib/tiles/16/12324/2569.png +3ms
  vite:time 2ms   /lib/tiles/16/12321/2569.png +1ms
  vite:time 3ms   /lib/tiles/16/12325/2569.png +7ms
  vite:time 3ms   /lib/tiles/16/12320/2569.png +1ms
  vite:time 3ms   /lib/tiles/16/12326/2569.png +0ms
  vite:time 1ms   /lib/tiles/16/12319/2569.png +69ms

Before submitting the issue, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
  • Provide a description in this issue that describes the bug.
  • Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.

β€œhttp://localhost:3000/lib/tiles/16/12320/2566.png” 404

Document tree structure
.
β”œβ”€β”€ README.md
β”œβ”€β”€ index.html
β”œβ”€β”€ lib
β”‚Β Β  β”œβ”€β”€ AreaRestriction_min.js
β”‚Β Β  β”œβ”€β”€ CurveLine.min.js
β”‚Β Β  β”œβ”€β”€ images
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ .....
β”‚Β Β  β”œβ”€β”€ jsθ§£ι‡Š.txt
β”‚Β Β  β”œβ”€β”€ map3.0.js
β”‚Β Β  β”œβ”€β”€ map3.0_init.js
β”‚Β Β  β”œβ”€β”€ modules
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ vmlcontext_41oars.js
β”‚Β Β  β”‚Β Β  └── 全部樑块.txt
β”‚Β Β  └── tiles
β”‚Β Β      β”œβ”€β”€ 14
β”‚Β Β          β”œβ”€β”€ 3078
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 640.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 641.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 642.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 643.png
β”‚Β Β          β”‚Β Β  └── 644.png
β”‚Β Β          β”œβ”€β”€ 3079
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 640.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 641.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 642.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 643.png
β”‚Β Β          β”‚Β Β  └── 644.png
β”‚Β Β          β”œβ”€β”€ 3080
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 642.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 643.png
β”‚Β Β          β”‚Β Β  └── 644.png
β”‚Β Β          β”œβ”€β”€ 3081
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 640.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 641.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 642.png
β”‚Β Β          β”‚Β Β  └── 644.png
β”‚Β Β          β”œβ”€β”€ 3082
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 640.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 641.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 642.png
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ 643.png
β”‚Β Β          β”‚Β Β  └── 644.png
β”‚Β Β          └── 3083
β”‚Β Β              β”œβ”€β”€ 640.png
β”‚Β Β              β”œβ”€β”€ 641.png
β”‚Β Β              β”œβ”€β”€ 642.png
β”‚Β Β              └── 644.png
β”œβ”€β”€ node_modules
β”‚    └──..... 
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
β”œβ”€β”€ public
β”‚Β Β  └── favicon.ico
β”œβ”€β”€ src
β”‚Β Β  β”œβ”€β”€ App.vue
β”‚Β Β  β”œβ”€β”€ assets
β”‚Β Β  β”‚Β Β  └── logo.png
β”‚Β Β  β”œβ”€β”€ components
β”‚Β Β  β”‚Β Β  └── HelloWorld.vue
β”‚Β Β  β”œβ”€β”€ index.css
β”‚Β Β  β”œβ”€β”€ main.js
β”‚Β Β  β”œβ”€β”€ main.js.map
β”‚Β Β  β”œβ”€β”€ main.ts
β”‚Β Β  β”œβ”€β”€ module
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ComplexCustomOverlay.js
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ComplexCustomOverlay.js.map
β”‚Β Β  β”‚Β Β  └── ComplexCustomOverlay.ts
β”‚Β Β  β”œβ”€β”€ router
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.js
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.js.map
β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β  └── shims-vue.d.ts
β”œβ”€β”€ tsconfig.json
└── vite.config.ts

709 directories, 21053 files

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
patak-devcommented, Apr 23, 2021

The issue is that v1 never got to a stable release and most users of Vite haven’t used that v1. By giving this a higher position you are lowering other topics that may help more people. We could add a note maybe at the getting started guide, but I don’t know if that would help. I think the best is to use the search functionality in the docs that would have guided you to the migration guide if you searched for β€œalias”

1reaction
patak-devcommented, Apr 23, 2021

The command should be npm init @vitejs/app

Read more comments on GitHub >

github_iconTop Results From Across the Web

Directory Alias in OHS Failing with 404 Error
Symptoms. On : 12.2.1.1.0 version, OHS Module When attempting to access a URI containing an alias defined in httpd.conf results in HTTP 404...
Read more >
SOLVED: Pathauto Alias always goes to 404 - Drupal
F.e. I have /node/1 and manually set /about alias. After change node, this is happening, /node/1 redirect to /about, but /about returns 404...
Read more >
Alias inside VirtualHost is not working and gives 404 error
I have a server which maintains multiple domains using VirtualHost and I'm trying to setup GitWeb according toΒ ...
Read more >
404 Error for Permalinks with Apache Alias and Wordpress
When you use Alias /blog then accessing WP posts using permalink example.com/blog/sample-post/ will be redirected to example.com by Apache soΒ ...
Read more >
Cannot seem to get domain alias to work--i'm getting 404 errors
I am using openlitespeed as part of the new package at digital ocean. I have setup several wordpress domains successfully and have them...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found