首页 > 其他分享 >Vite build errors All In One

Vite build errors All In One

时间:2023-08-05 17:33:31浏览次数:38  
标签:index resolve html errors build https vite Vite

Vite build errors All In One

errors

  1. 默认入口文件名 index.html,使用demo.html 与默认的不一致,导致构建报错 ❌

Could not resolve entry module "index.html".
error during build:
RollupError: Could not resolve entry module "index.html".

image

$ npx vite build

image

/** @type {import('vite').UserConfig} */
export default {
  // config options
  entry: './demo.html',// 不好使 ❌
  // index.html
}

https://main.vitejs.dev/config/

image

https://juejin.cn/s/vite index.html path

solutions

build/rollup/input

在构建过程中,只需指定多个 .html 文件作为入口点

import { resolve } from 'path'
import { defineConfig } from 'vite'

export default defineConfig({
  build: {
    rollupOptions: {
      input: {
        main: resolve(__dirname, 'demo.html'),// ✅ 使用 rollup 配置入口文件
        // main: resolve(__dirname, 'index.html'),
        // nested: resolve(__dirname, 'nested/index.html'),
      },
    },
  },
})

image

https://main.vitejs.dev/config/

https://rollupjs.org/configuration-options/#input

demos

(

标签:index,resolve,html,errors,build,https,vite,Vite
From: https://www.cnblogs.com/xgqfrms/p/17608280.html

相关文章

  • Exercise: Errors
    Go的接口+Error使用练习,正好里面还引入了一个小知识点,不要在Error()实现里面用Sprint一个实现了Error()的类型,因为Sprint里面会调用类型的Error(),无限循环。主要代码如下:1typeErrNegativeSqrtfloat6423func(eErrNegativeSqrt)Error()string{4returnfmt.S......
  • 使用Vue+Vite搭建在线 C++ 源代码混淆工具,带在线实例
    就酱紫github开源地址:https://github.com/dffxd-suntra/cppdgithub在线实例:https://dffxd-suntra.github.io/cppd/预览图片:长截屏背景图重复了,抱歉......
  • 关于powerbuilder的全局函数重载问题
    今天在调试反编译器,发掘几个网上下载的源码,是pb7写的程序,总是报错。最后ue打开仔细观察,发掘在一个func内赫然放着2个函数体。在最开始开发反编译器时,是从最简单的struct和func开始开发的,所以当初为struct和func单独写了函数,而且认定func内只有一个函数体。这就奇怪了。莫非是以前我......
  • 前端项目时因chunk-vendors过大导致首屏加载太慢,Vue Build时chunk-vendors的优化方案
    1、compression-webpack-plugin插件打包.gz文件安装插件也可以指定版本 我这里下载的是1.1.2版本的,试过更高的版本会有ES6语法的报错,因为我node使用的是v12,如果node版本更高可以尝试更高版本npminstall--save-devcompression-webpack-pluginnpminstall--save-devc......
  • Unity的IFilterBuildAssemblies:深入解析与实用案例
    UnityIFilterBuildAssembliesUnityIFilterBuildAssemblies是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目时自定义哪些程序集需要被包含在构建中,哪些程序集需要被排除在建之外。这个功能可以帮助开发者更好地控制项目的构建过程,减少构建时间和构建大小。在本文中,......
  • Unity的IPostprocessBuildWithReport:深入解析与实用案例
    UnityIPostprocessBuildWithReportUnityIPostprocessBuildWithReport是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目后自动执行一些操作,并且可以获取构建报告。这个功能可以帮助开发提高工作效率,减少手动操作的时间和错误率。在本文中,我们将介绍UnityIPostproces......
  • vite+vue3+ts+elementPlus前端框架搭建 [一]
    记录下搭建vite+vue3+ts+elementPlus项目的过程及遇到的问题。建议使用pnpm安装依赖,npm切换到pnpm链接地址:[https://www.pnpm.cn/installation]() 1.运行环境node-vv18.17.0npm-v9.8.12.使用pnpm创建vite项目及安装依赖npminitvite-apppnpmcreate......
  • String、StringBuffer和StringBuilder类的区别
    String在Java中字符串属于对象,Java提供了String类来创建和操作字符串。String类是不可变类,即当一个String变量被创建时,它将被存储在ConstantStringPool中。String之所以是不可变量,是因为,该类被fainal修饰在Java中,每一个非易失的变量都是线程安全的,因此String......
  • vite 项目webstorm跳转失效 VSCode、vue 无法对 @ 路径 跳转 ,几乎适用于所有webpack、
    在根目录加一个jsconfig.json文件{"compilerOptions":{"baseUrl":".","paths":{"@/*":["src/*"]},"target":"ES6","allowSyntheticDefaultImports&q......
  • Unity的IPreprocessBuildWithReport:深入解析与实用案例
    UnityIPreprocessBuildWithReportUnityIPreprocessBuildWithReport是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目时自动执行一些操作,并且可以获取构建报告。这个功能可以帮助开发者提高工作效率,减少手动操作的时间和错误率。在本文中,我们将介绍UnityIPreprocess......