The “path” argument must be of type string. Received undefined

"path"参数必须是字符串类型。收到未定义
在这里插入图片描述我是因为打包修改了项目的打包路径,导致了这个错误
assetsPublicPath: 代表打包后,index.html里面引用资源的相对地址
assetsSubDirectory: 除了 index.html 之外的静态资源要存放的路径

我的解决方法是
vue2:
在config/index.js

assetsSubDirectory: ‘static’,
assetsPublicPath: ‘/’,
在这里插入图片描述
vue3中:
在vue.config.js
publicPath: ‘./’,
//构建时的输出目录
outputDir: ‘html’,
//放置静态资源的目录
assetsDir: ‘static’,
//html 的输出路径
indexPath: ‘index.html’,
在这里插入图片描述我的解决方法是这样的,如果有更好的解决方法可以告诉我!

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐