antvis / util

utility library for AntV products.
MIT License
74 stars 27 forks source link

出现大量文件路径错误 #112

Open GuoDapeng opened 8 months ago

GuoDapeng commented 8 months ago
Failed to parse source map from '/Users/felix/Documents/MobileWork/work/数据大屏/tsrsdv/scene_drill/node_modules/@antv/util/esm/path/convert/src/path/convert/path-2-absolute.ts' file: Error: ENOENT: no sfile or directory, open '/Users/felix/Documents/MobileWork/work/数据大屏/tsrsdv/scene_drill/node_modules/@antv/util/esm/path/convert/src/path/convert/path-2-absolute.ts'

底下还有很多很多

在安装后,使用就会出现大量这样的路径错误。

下面是复现问题的步骤:

yarn create react-app scene --template typescript
cd scene
yarn add @antv/util

修改 App.tsx 文件:

import React from 'react';
import logo from './logo.svg';
import './App.css';
// 添加一行
import { gradient } from '@antv/util';

function App() {
  // 添加另一行
  console.log('gradient',gradient)
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.tsx</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}

export default App;

之后执行 yarn start 命令就可以看见大量 .ts 找不到了。

好像不影响使用,只是日志很长,看不见 On Your Network 了。

GuoDapeng commented 8 months ago

忽然发现项目目录创建 .env文件,里面写:

GENERATE_SOURCEMAP=false

这样就抑制了大量日志,但是浏览器调试会有一点点困难……

hustcc commented 8 months ago

有兴趣来一个 PR 吗,只需要构建的时候输出 sourcemap,然后发包带上即可。

GuoDapeng commented 8 months ago

我是一个很初级的程序员,我完全不理解 sourcemap 是怎么在这个项目立面生成的……很遗憾我没能把握住参与这个项目的机会。