返回

处理 XXX.js 的 source-maps 花费的时间比 YYY ms 长,所以我们继续执行而不等待所有断点

发布时间:2022-07-20 03:51:54 241

[编辑]这实际上也发生在新创建的准系统 React+Typescript 模板 ViteJS 应用程序上,修改为零。在 App.tsx 中放置断点会使 VS Code 调试器的启动速度慢得让人难以忍受。原帖如下:

我正在尝试 ViteJS(也许从 react-create-app 切换)。我使用 React Typescript 模板创建了一个准系统 Vite 应用程序。然后我引入了 DC.js、Mapbox 和其他一些库。

事情顺利进行了几个小时,然后突然(我不知道我做了什么),启动 VS Code 调试器(pwa-chrome在我的启动配置中使用)开始花费很长时间。也就是说,它会立即打开 Chrome,但它会出现在空白屏幕上,直到我的 VS Code 调试控制台完成写入以下警告:

WARNING: Processing source-maps of http://localhost:5173/node_modules/.vite/deps/chunk-YLBYPMLO.js?v=2e2948d4 took longer than 5679.765125 ms so we continued execution without waiting for all the breakpoints for the script to be set.

WARNING: Processing source-maps of http://localhost:5173/node_modules/.vite/deps/crossfilter2.js?v=2e2948d4 took longer than 1000.451959 ms so we continued execution without waiting for all the breakpoints for the script to be set.

WARNING: Processing source-maps of http://localhost:5173/node_modules/.vite/deps/d3.js?v=2e2948d4 took longer than 999.6403339999999 ms so we continued execution without waiting for all the breakpoints for the script to be set.

WARNING: Processing source-maps of http://localhost:5173/node_modules/.vite/deps/dc.js?v=2e2948d4 took longer than 999.535501 ms so we continued execution without waiting for all the breakpoints for the script to be set.

...and more similar warnings for other libraries like React and MapBox.

我已经搜索过这个“继续执行而不等待所有断点”警告,但互联网似乎相当安静。它来自 VS Code(请参阅https://github.com/microsoft/vscode-js-debug/blob/main/src/adapter/threads.ts),但在使用 WebPack 或其他开发人员之前我没有看到此警告-环境。它只是在切换到 ViteJS 后不久出现的,这就是为什么我怀疑它可能是我的 ViteJS 设置中的某些东西。

使用 Chrome Devtools 而不是 VS Code 进行调试工作正常(即立即启动)。我的肌肉记忆与 VS Code 调试器有关,所以我想继续使用它,但如果我每次启动它都必须等待 5 秒,我就不会了。

有什么想法可能导致这种情况吗?

我的 ViteJs 配置很简单,这正是您使用 ViteJS 创建 React Typescript 应用程序时所得到的:

import { defineConfig } from 'vite'

import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/

export default defineConfig({

  plugins: [

    react(),

  ],

})

任何帮助都非常感谢,谢谢!

[编辑]

我刚刚从我的应用程序中删除了除 React 之外的所有库,并将代码简化为这个(使用 ViteJS React Typescript 默认 main.tsx)。

export function App() {

    return (

    <div className="App">

      <h1>Testing Testing!</h1>

    </div>

  );

}

这消除了关于其他库源映射的大部分警告,只剩下这两个:

WARNING: Processing source-maps of http://localhost:5173/node_modules/.vite/deps/chunk-YLBYPMLO.js?v=585c1efb took longer than 5728.142083 ms so we continued execution without waiting for all the breakpoints for the script to be set.

WARNING: Processing source-maps of http://localhost:5173/node_modules/.vite/deps/react_jsx-dev-runtime.js?v=585c1efb took longer than 999.2322079999994 ms so we continued execution without waiting for all the breakpoints for the script to be set.

不知道这是否超级有用,除了表明不是因为我添加了 DC.js、Mapbox 等,这个问题发生在我身上。

FWIW,我可以添加"pauseForSourceMap": false到我的启动配置中。这消除了问题(调试器快速启动),除了我进入构建/生成的 javascript 文件以获取断点,并且仅在几秒钟后开始能够单步执行我的实际打字稿。

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像