npm run build后如何打开index.html跑起项目
Tip: built files are meant to be served over an HTTP server. Opening index.html over file:// won't work.
提示:构建的文件应该通过HTTP服务器提供服务。在文件:/上打开index.html不起作用。
其实直接本地就可以打开。。。
只需要在build配置文件修改:
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
/**
* Source Maps
*/
productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
npm run build后如何打开index.html跑起项目的更多相关文章
- Nodejs:npm run build之后,dist\index.html页面在火狐中可以正常显示登录页面并登录成功,在Chrome中可以正常显示登录页面,登录失败
问题描述:Nodejs:npm run build之后,dist\index.html页面在火狐中可以正常显示登录页面并登录成功,在Chrome中可以正常显示登录页面,登录失败 解决方法:将打包后的d ...
- Vue - 如何使用npm run build后的dist文件夹
脚手架vue cli生成项目后,使用 npm run build 生成了一个dist文件夹(应该是distribution的缩写) 只要放在http服务器上就可以运行. 使用一句python命令可以搭 ...
- vue-cli项目npm run build后,index.html无法在浏览器打开
- 在vue项目npm run build后,index.html中引入css和js 报MIME type问题
问题: 1.在vue项目中,build打包后,index页面打开会报错, MIME type ('text/html') ;报错内容:because its MIME type ('text/html ...
- vue-cli构建项目 npm run build后应该怎么运行在本地查看效果
问题: 就是 bulid 打包后,想本地看看效果,本地看不了.... 网上看到一个.... 具体更多在: http://www.dabaipm.cn/static/frontend/346.htm ...
- vue使用npm run build命令打包
vue使用npm run build命令打包项目 当我们使用vue-cli脚手架完成一个项目的时候,下一步肯定会想要怎么把这个项目放到互联网上或者本地直接打开呢,我们在本地调试的时候只要命令行执行 ...
- npm run build 打包后,如何查看效果
我们用vue-cli搭建的项目执行npm build后本地打开页面空白,如果才能查看npm run build之后的结果呢 首先我们看一下提示 Tip: built files are meant t ...
- npm run build 打包后空白页解决问题两种情况
问题一:assetsPublicPath配置错误 解决办法:打开config/index.js文件 build:{ // assetsPublicPath: '/' ass ...
- npm run build 打包后,如何运行在本地查看效果(Nginx服务)
这段时间,研究了一下vue 打包的很慢的问题.但是当我 npm run build 打包后,在本地查看效果的时候,活生生被我老大鄙视了,因为我打开了XAMPP.他说:你怎么不用Nginx啊?用这个一堆 ...
随机推荐
- airflow迁移
airflow迁移:airflow.cfg文件可以copydbinit时改数据参数 #airflow震乾源码copy:/data/venv/lib/python3.6/site-packages/ai ...
- 使用alias简化kubectl输入
在使用Kubernetes的过程中,我们需要经常使用kubectl(客户端)命令,经常敲下kubectl是非常繁琐的,使用Linux的alias可以为一些常见的命令起别名,这样使用起来就方便多了. ⒈ ...
- 区间DP(入门)括号匹配
https://www.nitacm.com/problem_show.php?pid=8314 思路:类似于https://blog.csdn.net/MIKASA3/article/details ...
- jquery的scrollTop方法
scrollTop方法设置或返回备选元素的垂直滚动条位置. 提示:当滚动条位于最顶部时,位置是0 当用于返回位置时: 该方法返回第一个匹配元素的滚动条的垂直位置 当用于设置位置时: 该方法设置所有匹配 ...
- Linux的一个后门引发对PAM的探究
转自http://www.91ri.org/16803.html 1.1 起因 今天在搜索关于Linux下的后门姿势时,发现一条命令如下:软链接后门: 1 ln -sf /usr/sbin/ssh ...
- QObject::connect可以对不继承QObject的类也使用信号槽
#include <QCoreApplication>#include <QDebug>#include <QObject>#include <QThread ...
- 并不对劲的CF1237D&E:Balanced Playlist and Binary Search Trees
CF1237D Balanced Playlist 题意 有一个长度为\(n\)(\(n\leq 10^5\))的循环播放歌单,每首歌有一个优秀值\(a_i\)(\(a_i\leq 10^9\)). ...
- python + Pyglet ---播放视频
记得安装pyglet 包,AVbin(http://avbin.github.io/AVbin/Download.html) 参考链接: Pyglet教程 http://www.hawstein.co ...
- JavaScript设计模式(发布订阅模式)
发布—订阅模式又叫观察者模式,它定义对象间的一种一对多的依赖关系,当一个对象的状态发生改变时,所有依赖于它的对象都将得到通知.在JavaScript开发中,我们一般用事件模型来替代传统的发布—订阅模式 ...
- 【原创】大叔经验分享(68)maven工程查看jar包依赖
1 idea 结果 2 maven命令 $ mvn dependency:tree 结果 [INFO] +- org.springframework.boot:spring-boot-starter- ...