vue3项目打包时,nprogress相关出错

src/permission.ts:5:23 - error TS7016: Could not find a declaration file for module 'nprogress'. 'V:/Web/Github_commit/GuiGuZhenXuan/cundang/Vue_project_SelectionPlatform/vue3_admin_template/project/node_modules/.pnpm/nprogress@0.2.0/node_modules/nprogress/nprogress.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/nprogress` if it exists or add a new declaration (.d.ts) file containing `declare module 'nprogress';`

5 import nprogress from 'nprogress'

在这里插入图片描述

解决方法:
第一步,跟着提示信息 npm i --save-dev @types/nprogress
第二步,借鉴这篇博客《TSC 编译出现》
在tsconfig.json文件中添加 "allowSyntheticDefaultImports": true
{
“compilerOptions”: {
// …
“allowSyntheticDefaultImports”: true
},
}
···

相关推荐

  1. Vue.js 3.0】NProgress 进度条

    2024-06-19 00:50:02       16 阅读
  2. Webpack打包vue项目

    2024-06-19 00:50:02       37 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-19 00:50:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-19 00:50:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-19 00:50:02       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-19 00:50:02       20 阅读

热门阅读

  1. 2024年安卓开发书籍推荐,含答案解析

    2024-06-19 00:50:02       4 阅读
  2. 2024.6.18.exercise

    2024-06-19 00:50:02       6 阅读
  3. 实际项目中如何实现分库分表

    2024-06-19 00:50:02       6 阅读
  4. 【前端面经】数组算法题解

    2024-06-19 00:50:02       6 阅读
  5. Codeforces Round 946 (Div. 3) E. Money Buys Happiness

    2024-06-19 00:50:02       7 阅读
  6. 12306全球最大票务系统与Gemfire介绍

    2024-06-19 00:50:02       9 阅读