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.

base option not support fully url at dev mode

See original GitHub issue

Describe the bug

from #833, the last comment.

In my case, use base like this:

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
export default defineConfig({
    plugins: [
        vue({
            template: {
                compilerOptions: {
                    isCustomElement: function(tag) {
                        return tag.includes("fl-") || tag.includes("sl-");
                    }
                }
            }
        })
    ],
    base: "http://localhost:3003/",
    root: "/Users/zhouyiming/Project/frameless-pc/src/pages/demo1"
});

But when i visit the http://localhost:3003/, the assets is not be rewrited image

if this page is nested in a “main” page, this request will be 404

image

Reproduction

https://stackblitz.com/edit/vitejs-vite-ofxh2y?file=vite.config.js&terminal=dev

System Info

System:
    OS: macOS 12.3.1
    CPU: (8) arm64 Apple M1
    Memory: 97.41 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 18.0.0 - /opt/homebrew/bin/node
    npm: 8.6.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 102.0.5005.115
    Safari: 15.4
  npmPackages:
    vite: ^2.9.9 => 2.9.9

Used Package Manager

pnpm

Logs

No response

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
patak-devcommented, Jun 13, 2022

One of the reasons that #8450 adds the options at build is to allow to do the same in the future for dev.advancedDevOptions. But the path there may be a bit long, and it is unclear to me at this point if the flexibility justifies the complexity at dev time. @Yiniau did you check https://vitejs.dev/config/#server-origin, this is what some backend integrations are using right now

1reaction
Yiniaucommented, Jun 13, 2022

you’re already serving the files via the url the vite dev server is on, e.g. localhost:3000.

actually, there are two servers is running,

  1. the main server run in port 10000
  2. the page server run in port 3000

that look like Single-SPA, if developer visit 3000, all be fine. but some assets will be 404 when they visit 10000.

if the url not change, any other config just helpless.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure on-device developer options - Android Developers
The Settings app on Android includes a screen called Developer options that ... Note: The adb demo mode commands might not work on...
Read more >
The Document Base URL element - HTML - MDN Web Docs
The HTML element specifies the base URL to use for all relative URLs in a document. There can be only one element in...
Read more >
Development Mode and Production Mode | Looker
Open the left navigation panel and select the Development Mode toggle. Select Exit Development Mode in the banner at the top of the...
Read more >
Show full URI/URL in Chrome's developer tools Network tab
When using Chrome to debug, I find it incredibly difficult to be efficient due to the fact that I don't see how I...
Read more >
Developer Mode - Duda Support
Click the Developer Mode button in navigation bar. Alternatively, right-click on a widget and select Edit HTML/CSS, and then click Dev Mode in...
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