Skip to content

resolvedUrls is null in plugin's configureServer #15438

Closed

Description

@yuan116

Describe the bug

Hi, I am developing a plugin for my own use
and found out the resolvedUrls is still null in plugin's configureServer after server restarted, but the printrUrls working fine

Environment:
node: v21.2.0
npm: 9.5.0

this is the little hack that I use to retrieve after server listen
Screenshot 2023-12-06 at 17 29 00

before server restart
Screenshot 2023-12-06 at 17 35 39

after server restart
Screenshot 2023-12-06 at 17 35 54

Reproduction

https://stackblitz.com/edit/vitejs-vite-5chbdo?file=custom-vite-plugin.js

Steps to reproduce

  1. npm run dev
  2. randomly edit the custom-vite-plugins.js, wait for server restart
  3. after server restarted, resolvedUrls is null

System Info

System:
  OS: Linux 5.0 undefined
  CPU: (6) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Memory: 0 Bytes / 0 Bytes
  Shell: 1.0 - /bin/jsh
Binaries:
  Node: 18.18.0 - /usr/local/bin/node
  Yarn: 1.22.19 - /usr/local/bin/yarn
  npm: 9.4.2 - /usr/local/bin/npm
  pnpm: 8.10.5 - /usr/local/bin/pnpm
npmPackages:
  vite: ^5.0.8 => 5.0.10

Used Package Manager

pnpm

Logs

No response

Validations

Activity

  1. bolt-new-by-stackblitz commented on Dec 27, 2023

    @bolt-new-by-stackblitz
  2. senaoxi commented on Dec 28, 2023

    @senaoxi
    Collaborator

    It seems that the front and back server instances are inconsistent.

    const newServer = { name: 'newServer' };
    await configureServerhook(newServer);
    const server = { name: 'server' };
    Object.assign(server, newServer); // server !== newServer
    server.resolvedUrls = {}; 

    This looks like a problem.

  3. added
    p3-minor-bug
    and removed on Jan 8, 2024
  4. locked and limited conversation to collaborators on Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions