小编给大家分享一下vue.config.js常用配置的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
坚守“ 做人真诚 · 做事靠谱 · 口碑至上 · 高效敬业 ”的价值观,专业网站建设服务10余年为成都成都格栅板 小微创业公司专业提供成都定制网站 营销网站建设商城网站建设手机网站建设小程序网站建设网站改版,从内容策划、视觉设计、底层架构、网页布局、功能开发迭代于一体的高端网站建设服务。
使用vue-cli3.0搭建项目比之前更简洁,没有了build和config文件夹。
vue-cli3的一些服务配置都迁移到CLI Service里面了,对于一些基础配置和一些扩展配置需要在根目录新建一个vue.config.js文件进行配置
module.exports = {
// 选项...
} 基本路径
baseUrl从 Vue CLI 3.3 起已弃用使用publicPath来替代。
在开发环境下,如果想把开发服务器 架设在根路径,可以使用一个条件式的值
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/production-sub-path/' : '/'
} 构建输出目录(打包位置)
outputDir
当运行 vue-cli-service build 时生成的生产环境构建文件的目录
module.exports = {
outputDir: 'dist',
} 静态资源目录
assetsDir
放置生成的静态资源 (js、css、img、fonts) 的目录
module.exports = {
assetsDir: 'assets',
} eslint代码检测
是否开启eslint保存检测,有效值:ture | false | 'error'
设置为 true 时,eslint-loader 会将 lint 错误输出为编译警告。默认情况下,警告仅仅会被输出到命令行,且不会使得编译失败
希望让 lint 错误在开发时直接显示在浏览器中,可以使用 lintOnSave: 'error'。这会强制 eslint-loader 将 lint 错误输出为编译错误
webpack-dev-server 相关配置
devServer
devServer: {
open: true,//设置自动打开
port: 1880,//设置端口
proxy: {
//设置代理
'/axios': {
target: 'http://101.15.22.98',
changeOrigin: true,
secure: false, //如果是http接口,需要配置该参数
pathRewrite: {
'^/axios': ''
}
}
}
}
} module.exports = {
// 部署应用时的基本 URL
publicPath: process.env.NODE_ENV === 'production' ? '192.168.60.110:8080' : '192.168.60.110:8080',
// build时构建文件的目录 构建时传入 --no-clean 可关闭该行为
outputDir: 'dist',
// build时放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
assetsDir: '',
// 指定生成的 index.html 的输出路径 (相对于 outputDir)。也可以是一个绝对路径。
indexPath: 'index.html',
// 默认在生成的静态资源文件名中包含hash以控制缓存
filenameHashing: true,
// 构建多页面应用,页面的配置
pages: {
index: {
// page 的入口
entry: 'src/index/main.js',
// 模板来源
template: 'public/index.html',
// 在 dist/index.html 的输出
filename: 'index.html',
// 当使用 title 选项时,
// template 中的 title 标签需要是 <%= htmlWebpackPlugin.options.title %>
title: 'Index Page',
// 在这个页面中包含的块,默认情况下会包含
// 提取出来的通用 chunk 和 vendor chunk。
chunks: ['chunk-vendors', 'chunk-common', 'index']
},
// 当使用只有入口的字符串格式时,
// 模板会被推导为 `public/subpage.html`
// 并且如果找不到的话,就回退到 `public/index.html`。
// 输出文件名会被推导为 `subpage.html`。
subpage: 'src/subpage/main.js'
},
// 是否在开发环境下通过 eslint-loader 在每次保存时 lint 代码 (在生产构建时禁用 eslint-loader)
lintOnSave: process.env.NODE_ENV !== 'production',
// 是否使用包含运行时编译器的 Vue 构建版本
runtimeCompiler: false,
// Babel 显式转译列表
transpileDependencies: [],
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建
productionSourceMap: true,
// 设置生成的 HTML 中 和
基本
文件
流程
错误
SQL
调试
请求信息 : 2026-05-10 03:59:06 HTTP/1.1 GET : /article/pddsgo.html 运行时间 : 0.0411s ( Load:0.0021s Init:0.0010s Exec:0.0330s Template:0.0051s ) 吞吐率 : 24.33req/s 内存开销 : 488.88 kb 查询信息 : 12 queries 5 writes 文件加载 : 36 缓存信息 : 0 gets 0 writes 配置加载 : 130 会话信息 : SESSION_ID=9qq21vcifafnrv6psq6qh3p042
/home/wwwroot/bluegullmedia/wwwroot/index.php ( 1.09 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/ThinkPHP.php ( 4.61 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Think.class.php ( 12.26 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Storage.class.php ( 1.37 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Storage/Driver/File.class.php ( 3.52 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Mode/common.php ( 2.82 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Common/functions.php ( 53.56 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Hook.class.php ( 4.01 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/App.class.php ( 13.49 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Dispatcher.class.php ( 14.79 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Route.class.php ( 13.36 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Controller.class.php ( 11.23 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/View.class.php ( 7.59 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/BuildLiteBehavior.class.php ( 3.68 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/ParseTemplateBehavior.class.php ( 3.88 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/ContentReplaceBehavior.class.php ( 1.91 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Conf/convention.php ( 11.15 KB ) /home/wwwroot/bluegullmedia/wwwroot/App/Common/Conf/config.php ( 2.16 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Lang/zh-cn.php ( 2.55 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Conf/debug.php ( 1.49 KB ) /home/wwwroot/bluegullmedia/wwwroot/App/Home/Conf/config.php ( 0.31 KB ) /home/wwwroot/bluegullmedia/wwwroot/App/Home/Common/function.php ( 3.33 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/ReadHtmlCacheBehavior.class.php ( 5.62 KB ) /home/wwwroot/bluegullmedia/wwwroot/App/Home/Controller/ArticleController.class.php ( 6.02 KB ) /home/wwwroot/bluegullmedia/wwwroot/App/Home/Controller/CommController.class.php ( 1.60 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Model.class.php ( 60.11 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Db.class.php ( 32.43 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Db/Driver/Pdo.class.php ( 16.74 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Cache.class.php ( 3.83 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Cache/Driver/File.class.php ( 5.87 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Template.class.php ( 28.16 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Template/TagLib/Cx.class.php ( 22.40 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Template/TagLib.class.php ( 9.16 KB ) /home/wwwroot/bluegullmedia/wwwroot/App/Runtime/Cache/Home/7540f392f42b28b481b30614275e4e55.php ( 18.20 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/WriteHtmlCacheBehavior.class.php ( 0.97 KB ) /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/ShowPageTraceBehavior.class.php ( 5.24 KB )
[ app_init ] --START-- Run Behavior\BuildLiteBehavior [ RunTime:0.000016s ] [ app_init ] --END-- [ RunTime:0.000082s ] [ app_begin ] --START-- Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000106s ] [ app_begin ] --END-- [ RunTime:0.000152s ] [ view_parse ] --START-- [ template_filter ] --START-- Run Behavior\ContentReplaceBehavior [ RunTime:0.000071s ] [ template_filter ] --END-- [ RunTime:0.000100s ] Run Behavior\ParseTemplateBehavior [ RunTime:0.004217s ] [ view_parse ] --END-- [ RunTime:0.004256s ] [ view_filter ] --START-- Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000094s ] [ view_filter ] --END-- [ RunTime:0.000118s ] [ app_end ] --START--
1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1
[ SQL语句 ] : SELECT `id`,`pid`,`navname` FROM `cx_nav` WHERE ( id= ) LIMIT 1 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1
[ SQL语句 ] : SELECT `id`,`navname` FROM `cx_nav` WHERE ( id= ) LIMIT 1 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
[ SQL语句 ] : SELECT `id`,`navname` FROM `cx_nav` WHERE ( pid= ) [8] Undefined index: pid /home/wwwroot/bluegullmedia/wwwroot/App/Home/Controller/ArticleController.class.php 第 47 行. [2] mkdir(): Permission denied /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Cache/Driver/File.class.php 第 59 行. [2] mkdir(): Permission denied /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Cache/Driver/File.class.php 第 59 行. [8] Undefined index: db_host /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Db.class.php 第 120 行. [8] Undefined index: db_port /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Db.class.php 第 121 行. [8] Undefined index: db_name /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Db.class.php 第 122 行.
0.0411s