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.

When I start using vite, the page shows 404

See original GitHub issue

Describe the bug

when I start use npm run dev, the page shows me 404 but no error

// package.json
{
    "dev": "vite",
}

Reproduction

this is my link

https://github.com/HuskyToMa/vue3Component

System Info

vite version: 1.0.0-rc.9 nodeversion: 12.16.1 system: macOS 10.15.3

Optional: npm version: 6.13.4 vue version: 3.0.2 from pacakge-lock.json @vue/compiler-sfc version: 3.0.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cmcnicholascommented, Jul 22, 2021

@cmcnicholas

is there some alternative to this, it really makes migrating a pain, we are at 40 minutes for a webpack build too 😦

First of all, are you using Vue2 or 3? The output from your npm install --force mentions both.

The easiest thing for you to do is

  1. git clone a vite template for your Vue version, like this one
  2. Copy your src folder into the template folder. Also, copy any static assets
  3. Run npm install
  4. Try running vite (npm run dev) and check for errors and try to resolve them.

Build systems are a pain in the ass, so piggybacking on work from someone else is highly recommended. Don’t waste your time trying to ‘fix’ your webpack build.

did you manage to get this to work for vue async imports too?

I don’t know what async imports are 😄 hope you’ll figure it out 🔥

thanks for this, unfortunately we have a big project, multiple project references with typescript, tooling etc. copying into one src is a bit problematic. I have managed to get vite working, works well, just seems when i update to the head version now @vitejs/plugin-vue has an explicit peer dependency to vue3 that wasn’t there before.

1reaction
MrYakobocommented, Jul 9, 2021

Don’t know if it’s relevant here, but I got 404 when starting up the dev server. The problem was that in vite.config.js, I had defined this since earlier:

resolve: {
    alias: [
        {
            find: '@',
            replacement: 'src',
        },
    ],
    extensions: ['.vue', '.js']
}

because I’m currently migrating my build to vite from Vue2 webpack template (vue init webpack), which historically has had that ruled defined to be able to do import Menu from @/components/Menu.

It made the script @vite/client not resolve. I removed this part of the config, find-replaced all @ with src manually and added .vue and .js to all imports, and vite started working again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue 3 + Vite dev server returns 404 on page reload of ...
I've isolated the problem to Vite. Everything works fine with Vue CLI. My vite.config.js : import loadVersion from 'vite-plugin-package-version ...
Read more >
Troubleshooting - Vite
Syntax Error / Type Error happens. Vite cannot handle and does not support code that only runs on non-strict mode (sloppy mode). This...
Read more >
404 error with React Router and gh-pages : r/reactjs - Reddit
Hi friends ! I've been trying to deploy a simple react website on gh-pages. The home page works really fine ! But when...
Read more >
Vite Headache - Endless 404 in console - Laracasts
I recently installed a new Laravel project and it now seems to have come with Vite instead of Webpack which is fine but...
Read more >
SSR Handling of 404 and 500 Errors - Quasar Framework
quasar/app-vite) Managing the common 404 and 500 HTTP errors in a Quasar ... then we can use Quasar CLI // to display a...
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