【发布时间】:2020-05-20 21:44:05
【问题描述】:
我正在使用 Next.js,并已按照 here 修改的配方 open bug report 修复节点中的断点。
Node 中的断点运行良好。他们也有点在 FireFox 中工作。当我在渲染中添加断点时,它会移动到不同的行,并且 VSCode 中会出现一个弹出窗口,上面写着:
此文件的路径未映射到 Firefox 加载的任何 url。也许您的调试配置需要此文件的路径映射 - 您想让路径映射向导尝试为您创建一个吗?
单击“是”不执行任何操作。它会在适当的点中断,但我试图弄清楚如何摆脱这个警告并阻止断点跳跃。
launch.json
"configurations": [
{
"name": "Next: Launch",
"type": "firefox",
"request": "launch",
"reAttach": true,
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"profile": "dev-edition-default"
},
{
"type": "node",
"request": "launch",
"name": "Next: Node",
"runtimeExecutable": "${workspaceFolder}/node_modules/next/dist/bin/next",
"port": 9230,
"console": "integratedTerminal",
"env": {
"NODE_OPTIONS": "--inspect=9230"
}
}],
"compounds": [
{
"name": "Next: Full Launch",
"configurations": ["Next: Node", "Next: Launch"]
},
{
"name": "Next: Full Attach",
"configurations": ["Next: Node", "Next: Attach"]
}
]
next.config.js
module.exports = {
webpack(config) {
config.devtool = "eval-source-map";
return config;
}
};
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"typeRoots": ["node_modules/mapkit-typescript", "node_modules/@types"],
"sourceMap": true
},
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
【问题讨论】:
-
你能找到解决这个问题的办法吗?我也有同样的问题
标签: javascript typescript firefox visual-studio-code next.js