数量报告堆栈跟踪中的线号不正确(Chrome/ff)。
破裂点根本没有触发(Chrome/ff)。{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome",
"request": "launch",
"type": "chrome",
"url": "http://localhost:3000",
"trace": true,
"sourceMaps": true,
"perScriptSourcemaps": "yes",
"webRoot": "${workspaceFolder}"
},
{
"name": "Firefox Debug",
"type": "firefox",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/src",
"skipFiles": [
"**/node_modules/**"
],
"pathMappings": [
{
"url": "http://localhost:3000",
"path": "${workspaceFolder}"
}
]
}
]
}
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import { sentryVitePlugin } from "@sentry/vite-plugin";
import { VitePWA } from 'vite-plugin-pwa';
import copy from 'rollup-plugin-copy'
import path from "path";
//import viteTsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig(({ mode }) => {
//import svgrPlugin from 'vite-plugin-svgr';
process.env = { ...process.env, ...loadEnv(mode, process.cwd(), '')};
return {
build: {
outDir: 'build',
sourcemap: true
},
plugins: [react(), VitePWA({
injectRegister: null,
strategies: 'injectManifest',
filename: 'service-worker.js',
srcDir: 'src',
devOptions: {
enabled: true,
type: "module",
},
injectManifest: {
maximumFileSizeToCacheInBytes: 20 * 1024 * 1024,
}
})],
resolve: {
alias: {
src: path.resolve(__dirname, "./src"),
},
},
preview: {
port: 3000
},
server: {
port: 3000,
host: "0.0.0.0"
}
};
});
vite“优化”(变换)JavaScript将其推向浏览器。并且(当前2/2025)VSCODE无法获取浏览器正在运行的实际代码。因此,Chrome调试器工作正常(具有实际代码),但是Vscode在node_modules/...中对原始源运行sourcemaps,并且通常会被许多行熄灭(因为Vite可能会插入newlines,因为它会在转换代码时)。
"builder": "@angular-devkit/build-angular:browser"
"options": {
"main": "src/main.ts",