首页 > 其他分享 >vitepress使用createContentLoader时遇到["vitepress" resolved to an ESM file. ESM file cannot be

vitepress使用createContentLoader时遇到["vitepress" resolved to an ESM file. ESM file cannot be

时间:2024-05-19 11:08:33浏览次数:20  
标签:resolved file createContentLoader vitepress loaded ESM

在使用vitepress构建一个所有博客的概览页的时候,使用到了createContentLoader这个api,但是在index.data.ts中定义并导出后,在md文件中调用遇到了下面这个问题:

Build failed with 1 error: node_modules/esbuild/lib/main.js:1374:27: ERROR: [plugin: externalize-deps] "vitepress" resolved to an ESM file. ESM file cannot be loaded by `require`. See https://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.

之后通过搜索vitepress的issues找到了这个解决方案:

把 package.json中的type改为module

{
  "name": "larry's blog",
  "version": "1.0.0",
  "type": "module"
}

改完后记得重新运行一下项目~

issue地址

标签:resolved,file,createContentLoader,vitepress,loaded,ESM
From: https://www.cnblogs.com/azoux/p/18200142

相关文章

  • Serv-U MFT Server(Managed File Transfer Server)是一款专为企业级用户设计的文件传输
    Serv-UMFTServer(ManagedFileTransferServer)是一款专为企业级用户设计的文件传输解决方案,它是基于著名的Serv-UFTPServer的增强版,专注于提供更加安全、可控和高效的文件传输服务。MFT(ManagedFileTransfer)即管理型文件传输,与传统的FTP相比,它更加强调安全性、合规性和可......
  • vitepress 如何更换 favicon.ico
    favicon.ico它出现在浏览器标签页上,是网站的标识之一。准备图标首先,你需要准备一个符合您要求的图标。通常,favicon.ico使用的是.ico格式的图标文件,大小为16x16像素。你可以用图标编辑器或在线图标生成器创建一个.ico文件。替换默认的favicon.ico找到你的docs目录,如果......
  • jenkinsfile流水线
     参考:https://blog.csdn.net/wx17343624830/article/details/136906665参考:https://blog.csdn.net/Step_By_XXX/article/details/131470414pipeline{agentanytools{maven'Maven-3.9.6'}parameters{gitParameterbranchFilter:......
  • linux内核Makefile和busybox编译
    刚开始学习Linux时的一些记录linux内核配置体验在arch/arm/configs/目录下面找到相似的配置文件,其名称一般为xxx_defconfigmakexxx_defconfigmakemenuconfig配置你的内核,配置完成后生成.config文件在TOPDIR,该文件由于是以‘.’开头,故在linux下是一个隐藏的文件。生成......
  • 从头理清uboot(1)-makefile 分析
    目录1.简单介绍及背景2.makefile分析2.1执行makemx6ull_14x14_ddr512_emmc_defconfig之后会发生什么?1.scripts_basic:2.outputmakefile3.FORCE2.2对于实际命令的进一步分析1)@make-f./scripts/Makefile.buildobj=scripts/basic2)@make-f./scripts/Makefile.build......
  • python sftp文件上传和Dockerfile部署步骤
    ##1、脚本app.py#-*-coding:utf8-*-importosimportparamikofromdatetimeimportdatetime,timedeltafromflaskimportFlask,requestapp=Flask(__name__)#从环境变量中获取配置信息host=os.getenv("SFTP_HOST")port=int(os.getenv("SFTP_PORT&q......
  • docker启动java容器报错unable to allocate file descriptor table - out of memory
    问题:启动java进程报错{"log":"libraryinitializationfailed-unabletoallocatefiledescriptortable-outofmemory","stream":"stderr","time":"2024-05-15T06:27:14.681052443Z"}原因:LimitNOFILE=infinity......
  • idea jprofiler内存快照分析
    1、idea按照jprofiler插件setting->plugins->marketplace搜索jprofiler,安装并重启2、分析dump文件dump内存快照方式:jmap-dump:format=b,file=heapdump.phrof{jvm的pid}使用jprofiler导入dump文件导入成功3、jprofiler工具关注“BiggestObjects”、"GCroots"、"Packa......
  • [996] Upload a file to an Amazon S3 bucket and obtain the URL of it using Python
    Certainly!TouploadafiletoanAmazonS3bucketusingPython(specificallywiththeboto3library)andobtainthelink(URL)forthatfile,followthesesteps:InstallBoto3:Makesureyouhavetheboto3libraryinstalled.Ifnot,youcaninstallit......
  • how BabyFile app transfer files with Windows PC though data cable
    1.WindowsPCdownload"iTunes"App.Asfollows:2.WindowsPCconnecttheiPhone/iPadwithadatacable,andthen open"iTunes"app, findandclicktheconnecteddevice.asmarkedby①inthepicture. 2.Findand clickthe"Fi......