如何解决带脚本的Nextjs
带有typescript的Nextjs在部署时显示了一些错误,而在开发时未显示这样的错误:
13:09:26 Failed to compile.
13:09:26 ./node_modules/next/dist/build/webpack/plugins/pages-manifest-plugin.d.ts:1:34
13:09:26 Type error: Could not find a declaration file for module 'webpack'. '/vercel/36bc1d70/node_modules/webpack/lib/webpack.js' implicitly has an 'any' type.
13:09:26 Try `npm install @types/webpack` if it exists or add a new declaration (.d.ts) file containing `declare module 'webpack';`
13:09:26 [0m[31m[1m>[22m[39m[90m 1 | [39m[36mimport[39m { [33mCompiler[39m[33m,[39m [33mPlugin[39m } from [32m'webpack'[39m[33m;[39m[0m
13:09:26 [0m [90m | [39m [31m[1m^[22m[39m[0m
13:09:26 [0m [90m 2 | [39m[36mexport[39m declare type [33mPagesManifest[39m [33m=[39m {[0m
13:09:26 [0m [90m 3 | [39m [page[33m:[39m string][33m:[39m string[33m;[39m[0m
13:09:26 [0m [90m 4 | [39m}[33m;[39m[0m
13:09:26 error Command failed with exit code 1.
13:09:26 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
13:09:26 Error: Command "yarn run vercel-build" exited with 1
13:09:28 Done with "package.json" ```
解决方法
安装绝对类型的Webpack软件包@types/webpack
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。