Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ssr): sourcemap initModule #12126

Closed
wants to merge 1 commit into from

Conversation

FuPeiJiang
Copy link

Description

this is for debugging +server.js when running Run Script: dev
, currently, vscode finds the correct file, but when vscode stops at debugger; statement, the line number is off by +2.

this is because those two lines are always added:

(async function anonymous(global,__vite_ssr_exports__,__vite_ssr_import_meta__,__vite_ssr_import__,__vite_ssr_dynamic_import__,__vite_ssr_exportAll__
) {

I consider this eval() but it's new AsyncFunction

I assume initModule() is used for debugging only (vite dev), and not for prod (vite build then vite preview)
so my fix is to pad the sourcemap : mappings : with ;;

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

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

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@FuPeiJiang FuPeiJiang changed the title sourcemap initModule fix(ssr): sourcemap initModule Feb 20, 2023
@sapphi-red
Copy link
Member

Closing as this is implemented by #11780

@sapphi-red sapphi-red closed this Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants