如何解决 Critical dependency: the request of a dependency is an expression ?

更多ruoyi-nbcio功能请看演示系统

gitee源代码地址

前后端代码: ruoyi-nbcio: nbcio-boot的若依版本,基于ruoyi-flowable-plus和flowable6.7.2,目前处于开发功能完善阶段,目标是打造一个最好的若依平台上flowable流程管理系统开源版本,后续也增加一个仿钉钉流程设计,希望有需要的同仁一起打造。如果觉得这个项目对你有帮助,麻烦点个star。

演示地址:RuoYi-Nbcio后台管理系统

ruoyi-nbcio 前端编译出现下面问题

98% after emitting CopyPlugin

WARNING Compiled with 1 warning 10:46:08

warning in ./src/components/HeaderNotice/DynamicNotice.vue?vue&type=script&lang=js&

Critical dependency: the request of a dependency is an expression

App running at:

主要是下面语句问题

return () => import(`@/views/${this.path}.vue`)

应该是跟webpack版本相关,可能的bug吧,webpack4中动态import不支持变量方式。

以后版本升级可以解决,目前先临时用下面方法解决吧。

javascript 复制代码
computed: {
      comp: function () {
        if(!this.path){
          return null;
        }
        //return () => import(`@/views/${this.path}.vue`)
        //去掉这个编译警告Critical dependency: the request of a dependency is an expression
        return () => Promise.resolve(require(`@/views/${this.path}.vue`).default)
      }
相关推荐
gc_229914 小时前
使用VS Code终端创建Vue项目报错:“npm : 无法加载文件 ...\npm.ps1,因为在此系统上禁止运行脚本”
vue·vs code
小阿鑫18 小时前
尤雨溪 : Vue 4 已经在规划中了!
vue·vite·vite+·程序员海军·vue4
离歌漠2 天前
《我用 Tauri 做了一个本地开发工具箱》
rust·typescript·vue
enjoy编程2 天前
playwright学习-I
typescript·vue·nodejs·1024程序员节·playwright
落花看风雪4 天前
从零开始搭建后台系统(vue3+TypeScript+Vite)01
typescript·vue·js
咖啡八杯6 天前
Spring MessageSource 国际化消息解析流程
java·后端·spring·架构·框架·若依
那年那棵树9 天前
基于WebGis的人生如旅地图系统
前端·arcgis·vue·课程设计
冒险的豆子12 天前
Vue2 、Vue3 响应式对比及优劣
vue
NetX行者12 天前
用 Vite + Vue3 + UnoCSS 搭建企业级项目模板(一):基础骨架
vue·vite·unocss