0
Follow
0
View

Problems setting up debugging in Visual Studio code for Chrome, have it working for Firefox

daidaikeai0816 注册会员
2023-01-25 16:44

first you need to set launch.json and then set your config file as you need:

hereafter an example which works with vite running as bundler in front and server in back

{
"debug": {
    "javascript": {
        "terminalOptions": {
            "skipFiles": [
                "/**"
            ],
            "trace": true
        }
    }
},
"configurations": [
    {
        "name": "Run bundler",
        "request": "launch",
        "type": "node-terminal",
        "command": "npm run ",
        "cwd": "${workspaceFolder}"
    }
]

}

Then forget webpack and use vite, thus you need to install vite and a vite config file

 import { defineConfig } from 'vite';
 import vue from '@vitejs/plugin-vue';
 // cf. https://vitejs.dev/config/
 export default defineConfig(async ({ command, mode }) => {
 return {
    plugins: [vue()],
    server: {
        proxy: {
            '/api/': {
                target: 'http://localhost:3080',
                changeOrigin: true,
                secure: false
            }
        },
        port: 3080,
        strictPort: true
    },
    build: {
        outDir: './server/public'
    }
 };
 });

I use typescript and in my ts.config.json, I setted

 ...
 "sourceMap": true,
 "types": ["vite/server"],
 "skipLibCheck": true,
 "forceConsistentCasingInFileNames": true
 ...
 

hope that's will help folk's !