当前位置:网站首页>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即可。
(完)
边栏推荐
- 数据的储存
- Foreign trade marketing website system development function case making
- Visual Studio导入
- Gee dataset: chirps pentad high resolution global grid rainfall dataset
- Résumé de la collection de plug - ins couramment utilisée dans les outils de développement idea
- 指针使用详解
- VSCode paste image插件保存图片路径设置
- JVM class loading mechanism
- Gee series: unit 6 building various remote sensing indexes in Google Earth engine
- How matlab marks' a 'in the figure and how matlab marks points and solid points in the figure
猜你喜欢

RGB 无限立方体(高级版)

2022-2-15 learning xiangniuke project - Section 8 check login status

KMP idea and template code
![Gee series: unit 7 remote sensing image classification using GEE [random forest classification]](/img/01/ba9441b7b1efaed85c464316740edb.jpg)
Gee series: unit 7 remote sensing image classification using GEE [random forest classification]

【論文翻譯】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond

Installation du tutoriel MySQL 8.0.22 par centos8

在线音乐播放器app

kmp思想及模板代码

all3dp.com网站中全部Arduino项目(2022.7.1)

Gee series: Unit 3 raster remote sensing image band characteristics and rendering visualization
随机推荐
Foreign trade marketing website system development function case making
Gee data set: export the distribution and installed capacity of hydropower stations in the country to CSV table
Small and medium-sized projects to achieve certification and authorization of hand filter
Balsamiq wireframes free installation
[golang syntax] be careful with the copy of slices
Storage of data
Two implementation methods of delay queue
Résumé de la collection de plug - ins couramment utilisée dans les outils de développement idea
2022-2-14 learning xiangniuke project - Section 6 displays login information
"Simple" infinite magic cube
1037 Magic Coupon
“简单”的无限魔方
h5跳小程序
Here comes a new chapter in the series of data conversion when exporting with easyexcel!
kmp思想及模板代码
【論文翻譯】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
"Original, excellent and vulgar" in operation and maintenance work
460. LFU 缓存 双向链表
Operator details
1035 Password