Skip to content

SSR SourceMap not loaded when debugging #3288

@DylanPiercey

Description

@DylanPiercey

Describe the bug

Currently it looks like when debugging the node process with source maps enabled (node --inspect --enable-source-maps ./source.js) that the source maps are not actually loaded.

Reproduction

Load any file via ssrLoadModule with a debugger.
You will see that the debugger shows compiled code instead of the source.

eg:

source.js

const { createServer } = require('vite')

(async () => {
  const server = await createServer({ server: { middlewareMode: true } });
  await server.ssrLoadModule("./debug.js");
})();

debug.js

debugger;
console.log("debugging", import.meta.url);

Then run

node --inspect-brk --enable-source-maps ./source.js

And finally connect your favorite debugger.

System Info

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

  System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
    Memory: 504.64 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.12 - ~/.nvm/versions/node/v14.16.1/bin/npm
  Browsers:
    Edge: 90.0.818.51
    Firefox: 87.0
    Safari: 14.1
  npmPackages:
    vite: ^2.2.4 => 2.2.4

Used package manager: npm


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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: ssrp3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions