当前位置:网站首页>Vite打包后的dist不能直接在浏览器打开吗
Vite打包后的dist不能直接在浏览器打开吗
2022-07-02 05:41:00 【用户体验官大龙】
不能
原因
Vite 本身依赖于原生ES模块来做模块加载,而原生ES模块是不支持 file:// 本地访问的。
解决办法
方案一:使用http-server插件启动
1.安装node.js;(已安装跳过)
2.安装http-server。
npm install http-server -g或
yarn global add http-server3、进入dist根目录执行启动项目
http-server方案二:使用nginx启动
1、把dist拷贝至nginx的html目录下(其他目录也行,需在nginx里配置root);

2、配置nginx.conf

3、保存并启动nginx,访问http://127.0.0.1:3000即可。
(完)
边栏推荐
- idea开发工具常用的插件合集汇总
- Gee: remote sensing image composite and mosaic
- Small and medium-sized projects to achieve certification and authorization of hand filter
- Fabric. JS iText set italics manually
- Importation de studio visuel
- How matlab marks' a 'in the figure and how matlab marks points and solid points in the figure
- "Original, excellent and vulgar" in operation and maintenance work
- Zzuli:1062 greatest common divisor
- brew install * 失败,解决方法
- Visual Studio導入
猜你喜欢

all3dp. All Arduino projects in com website (2022.7.1)

死磕大屏UI,FineReport开发日记

5g market trend in 2020

Fabric. JS upload local image to canvas background

7.TCP的十一种状态集

Importation de studio visuel

Thunder on the ground! Another domestic 5g chip comes out: surpass Huawei and lead the world in performance?

Fabric. JS activation input box

数据的储存

Storage of data
随机推荐
Gee: create a new feature and set corresponding attributes
[personal test] copy and paste code between VirtualBox virtual machine and local
Taskbar explicit / implicit toggle function
Visual Studio导入
Gee data set: export the distribution and installed capacity of hydropower stations in the country to CSV table
Online English teaching app open source platform (customized)
Conglin environmental protection rushes to the scientific and Technological Innovation Board: it plans to raise 2billion yuan, with an annual profit of more than 200million yuan
Php/js cookie sharing across domains
7.TCP的十一种状态集
2022-2-14 learning xiangniuke project - Section 6 displays login information
VSCode paste image插件保存图片路径设置
Opencv LBP features
"Original, excellent and vulgar" in operation and maintenance work
2022-2-14 learning xiangniuke project - Section 7 account setting
1036 Boys vs Girls
Fabric. JS 3 APIs to set canvas width and height
简单封装 js并应用
Grbl software: basic knowledge of simple explanation
Thread pool overview
Gee series: Unit 5 remote sensing image preprocessing [GEE grid preprocessing]