网站搜索

typescript - Vercel 因“@”而无法部署?


我已经寻找了一段时间,也许是因为我做研究的方式,但无论如何我还是要问这个问题。

我正在处理一个 react.js/next 环境,然后我在一个我必须自定义的库上工作,该库是用 Typescript 编写的。处理这个没有问题,但当我将最终版本部署到 Vercel 时,我遇到了 3 个错误。

./helper/react-gutenberg/dist/blocks/common/audio.js
    13:06:35.878    Module not found: Can't resolve '@mantine/core' in '/vercel/path0/helper/react-gutenberg/dist/blocks/common'
    13:06:35.879    
    13:06:35.879    Import trace for requested module:
    13:06:35.880    ./helper/react-gutenberg/dist/blocks/common/audio.js
    13:06:35.880    ./helper/react-gutenberg/dist/blocks/common/index.js
    13:06:35.881    ./helper/react-gutenberg/dist/blocks/index.js
    13:06:35.881    ./helper/react-gutenberg/dist/index.js
    13:06:35.881    ./helper/react-gutenberg/index.js
    13:06:35.881    
    13:06:35.881    ./helper/react-gutenberg/dist/blocks/common/audio.js
    13:06:35.881    Module not found: Can't resolve '@material-ui/icons/ArrowRightAlt' in '/vercel/path0/helper/react-gutenberg/dist/blocks/common'
    13:06:35.881    
    13:06:35.881    Import trace for requested module:
    13:06:35.881    ./helper/react-gutenberg/dist/blocks/common/audio.js
    13:06:35.881    ./helper/react-gutenberg/dist/blocks/common/index.js
    13:06:35.881    ./helper/react-gutenberg/dist/blocks/index.js
    13:06:35.881    ./helper/react-gutenberg/dist/index.js
    13:06:35.881    ./helper/react-gutenberg/index.js
    13:06:35.881    
    13:06:35.882    ./helper/react-gutenberg/dist/blocks/common/audio.js
    13:06:35.882    Module not found: Can't resolve '@mantine/hooks' in '/vercel/path0/helper/react-gutenberg/dist/blocks/common'

关键似乎是命名空间中有一个“@”,当我使用 tsc 构建文件时,生成的 js 文件在 require 它时没有处理这个 @。非常感谢你的帮助

我尝试在 Vercel 上部署,但根本不行,编译失败。